
iOS 10 Swift Programming Cookbook
Solutions and Examples for iOS Apps
Publisher: O'Reilly Media
Release Date: December 2016
Pages: 456
Read on Safari with a 10-day trial
Start your free trial now Buy on AmazonWhere’s the cart? Now you can get everything on Safari. To purchase books, visit Amazon or your favorite retailer. Questions? See our FAQ or contact customer service:
1-800-889-8969 / 707-827-7019
support@oreilly.com
Ready to build truly stunning apps for iPhone, iPad, and Apple Watch? This cookbook—written exclusively in Swift 3—provides more than 120 proven solutions for tackling the latest features in iOS 10 and watchOS 3. With these code-rich recipes, you’ll learn how to build dynamic voice interfaces with Siri and messaging apps with iMessage. You’ll also learn how to use interactive maps, multitasking functionality, the UI Testing framework, and many other features.
This cookbook is ideal for intermediate and advanced iOS developers looking to work with the newest versions of Apple’s mobile operating systems. Each recipe includes reusable code that's available on GitHub, so you can put it to work right away.
- Let users interact with your apps and services through Siri
- Write your own iMessage extensions that allow added interactivity
- Work with features in Swift 3, Xcode 8, and Interface Builder
- Build standalone apps for Apple Watch
- Create vibrant user interfaces with new UIKit features
- Use Spotlight APIs to make your app content searchable
- Add Picture in Picture playback functionality to iPad apps
- Take advantage of MapKit and Core Location updates
- Use Apple’s new UI Testing framework
- Liven up your UI with gravity and turbulence fields
Table of Contents
-
Chapter 1 iMessage Stickers and Apps
-
1.1. Setting Up a Sticker Pack Application
-
1.2. Adjusting Sticker Sizes
-
1.3. Building a Full-Fledged iMessage Application
-
1.4. Adding an iMessage App Extension to an Existing App
-
1.5. Utilizing an Expanded View in a Sticker Pack App
-
1.6. Appending Rich Information to Stickers
-
1.7. Creating Interactive Conversations with iMessage Apps
-
-
Chapter 2 SiriKit
-
2.1. Setting Up Your Project for Siri
-
2.2. Defining an Intent Handler
-
2.3. Resolving Ambiguity in an Intent
-
2.4. Reporting Progress for Resolving an Intent
-
2.5. Handling an Intent
-
-
Chapter 3 Measurements and Units
-
3.1. Converting Between and Working with Length Units
-
3.2. Working with and Switching Between Angle Units
-
3.3. Representing and Converting Between Durations of Time
-
3.4. Using and Working with Frequency Units
-
3.5. Working with and Using Power Units
-
3.6. Representing and Comparing Temperature Units
-
3.7. Working with and Converting Volume Units
-
-
Chapter 4 Core Data
-
4.1. Designing Your Database Scheme
-
4.2. Writing Data to the Database
-
4.3. Reading Data from the Database
-
4.4. Searching for Data in the Database
-
4.5. Performing Background Tasks with Core Data
-
-
Chapter 5 Swift 3.0, Xcode 8, and Interface Builder
-
5.1. Handling Errors in Swift
-
5.2. Specifying Preconditions for Methods
-
5.3. Ensuring the Execution of Code Blocks Before Exiting Methods
-
5.4. Checking for API Availability
-
5.5. Categorizing and Downloading Assets to Get Smaller Binaries
-
5.6. Exporting Device-Specific Binaries
-
5.7. Linking Separate Storyboards Together
-
5.8. Adding Multiple Buttons to the Navigation Bar
-
5.9. Optimizing Your Swift Code
-
5.10. Showing the Header View of Your Swift Classes
-
5.11. Creating Your Own Set Types
-
5.12. Conditionally Extending a Type
-
5.13. Building Equality Functionality into Your Own Types
-
5.14. Looping Conditionally Through a Collection
-
5.15. Designing Interactive Interface Objects in Playgrounds
-
5.16. Grouping Switch Statement Cases Together
-
5.17. Bundling and Reading Data in Your Apps
-
-
Chapter 6 The User Interface
-
6.1. Animating Views
-
6.2. Attaching Live Views to Playgrounds
-
6.3. Running Playgrounds as Interactive and Continuous Apps
-
6.4. Arranging Your Components Horizontally or Vertically
-
6.5. Customizing Stack Views for Different Screen Sizes
-
6.6. Creating Anchored Constraints in Code
-
6.7. Allowing Users to Enter Text in Response to Local and Remote Notifications
-
6.8. Dealing with Stacked Views in Code
-
6.9. Showing Web Content in Safari View Controller
-
6.10. Laying Out Text-Based Content on Your Views
-
6.11. Improving Touch Rates for Smoother UI Interactions
-
6.12. Supporting Right-to-Left Languages
-
6.13. Associating Keyboard Shortcuts with View Controllers
-
6.14. Recording the Screen and Sharing the Video
-
-
Chapter 7 Apple Watch
-
7.1. Downloading Files onto the Apple Watch
-
7.2. Noticing Changes in Pairing State Between the iOS and Watch Apps
-
7.3. Transferring Small Pieces of Data to and from the Watch
-
7.4. Transferring Dictionaries in Queues to and from the Watch
-
7.5. Transferring Files to and from the Watch
-
7.6. Communicating Interactively Between iOS and watchOS
-
7.7. Setting Up Apple Watch for Custom Complications
-
7.8. Constructing Small Complications with Text and Images
-
7.9. Displaying Time Offsets in Complications
-
7.10. Displaying Dates in Complications
-
7.11. Displaying Times in Complications
-
7.12. Displaying Time Intervals in Complications
-
7.13. Recording Audio in Your Watch App
-
7.14. Playing Local and Remote Audio and Video in Your Watch App
-
-
Chapter 8 Contacts
-
8.1. Creating Contacts
-
8.2. Searching for Contacts
-
8.3. Updating Contacts
-
8.4. Deleting Contacts
-
8.5. Formatting Contact Data
-
8.6. Picking Contacts with the Prebuilt System UI
-
8.7. Creating Contacts with a Prebuilt System UI
-
8.8. Displaying Contacts with a Prebuilt System UI
-
-
Chapter 9 Extensions
-
9.1. Creating Safari Content Blockers
-
9.2. Creating Shared Links for Safari
-
9.3. Maintaining Your App’s Indexed Content
-
-
Chapter 10 Web and Search
-
10.1. Making Your App’s Content Searchable
-
10.2. Making User Activities Searchable
-
10.3. Deleting Your App’s Searchable Content
-
-
Chapter 11 Multitasking
-
11.1. Supporting Split Views
-
11.2. Adding Picture in Picture Playback Functionality
-
11.3. Handling Low Power Mode and Providing Alternatives
-
-
Chapter 12 Maps and Location
-
12.1. Displaying a Specific Location on the Map
-
12.2. Requesting the User’s Location a Single Time
-
12.3. Requesting the User’s Location in the Background
-
12.4. Customizing the Tint Color of Pins on the Map
-
12.5. Providing Detailed Pin Information with Custom Views
-
12.6. Displaying Traffic, Scale, and Compass Indicators on the Map
-
12.7. Providing an ETA for Transit Transport Type
-
12.8. Launching the iOS Maps App in Transit Mode
-
12.9. Showing Maps in Flyover Mode
-
-
Chapter 13 UI Testing
-
13.1. Preparing Your Project for UI Testing
-
13.2. Automating UI Test Scripts
-
13.3. Testing Text Fields, Buttons, and Labels
-
13.4. Finding UI Components
-
13.5. Long-Pressing on UI Elements
-
13.6. Typing Inside Text Fields
-
13.7. Swiping on UI Elements
-
13.8. Tapping UI Elements
-
-
Chapter 14 Core Motion
-
14.1. Querying Pace and Cadence Information
-
14.2. Recording and Reading Accelerometer Data
-
-
Chapter 15 Security
-
15.1. Protecting Your Network Connections with ATS
-
15.2. Binding Keychain Items to Passcode and Touch ID
-
15.3. Opening URLs Safely
-
15.4. Authenticating the User with Touch ID and Timeout
-
-
Chapter 16 Multimedia
-
16.1. Reading Out Text with the Default Siri Alex Voice
-
16.2. Downloading and Preparing Remote Media for Playback
-
16.3. Enabling Spoken Audio Sessions
-
-
Chapter 17 UI Dynamics
-
17.1. Adding a Radial Gravity Field to Your UI
-
17.2. Creating a Linear Gravity Field on Your UI
-
17.3. Creating Turbulence Effects with Animations
-
17.4. Adding Animated Noise Effects to Your UI
-
17.5. Creating a Magnetic Effect Between UI Components
-
17.6. Designing a Velocity Field on Your UI
-
17.7. Handling Collisions Between Nonrectangular Views
-