iOS 9 Swift Programming Cookbook (2015)

iOS 9 Swift Programming Cookbook (2015)

Chapter 1. Swift 2.0, Xcode 7 and Interface Builder

1.1 Handling Errors in Swift

1.2 Specifying Preconditions for Methods

1.3 Ensuring the Execution of Code Blocks Before Exiting Methods

1.4 Checking for API Availability

1.5 Categorizing and Downloading Assets to Get Smaller Binaries

1.6 Exporting Device-Specific Binaries

1.7 Linking Separate Storyboards Together

1.8 Adding Multiple Buttons to the Navigation Bar

1.9 Optimizing Your Swift Code

1.10 Showing the Header View of Your Swift Classes

1.11 Creating Your Own Set Types

1.12 Conditionally Extending a Type

1.13 Building Equality Functionality Into Your Own Types

1.14 Looping Conditionally Through a Collection

1.15 Designing Interactive Interface Objects in Playgrounds

1.16 Grouping Switch Statement Cases Together

1.17 Bundling and Reading Data in Your Apps

Chapter 2. Apple Watch

2.1 Downloading Files Onto the Apple Watch

2.2 Noticing Changes in Pairing State Between the iOS and Watch Apps

2.3 Transferring Small Pieces of Data To and From the Watch

2.4 Transferring Dictionaries in Queues To and From the Watch

2.5 Transferring Files To and From the Watch

2.6 Communicating Interactively Between iOS and watchOS

2.7 Setting up Apple Watch for Custom Complications

2.8 Constructing Small Complications with Text and Images

2.9 Displaying Time Offsets in Complications

2.10 Displaying Dates in Complications

2.11 Displaying Times in Complications

2.12 Displaying Time Intervals in Complications

2.13 Recording Audio in Your Watch App

2.14 Playing Local and Remote Audio and Video in Your Watch App

Chapter 3. The User Interface

3.1 Arranging Your Components Horizontally or Vertically

3.2 Customizing Stack Views for Different Screen Sizes

3.3 Creating Anchored Constraints in Code

3.4 Allowing Users to Enter Text in Response to Local and Remote Notifications

3.5 Dealing with Stacked Views in Code

3.6 Showing Web Content in Safari View Controller

3.7 Laying Out Text-Based Content on Your Views

3.8 Improving Touch Rates for Smoother UI Interactions

3.9 Supporting Right-to-Left Languages

3.10 Associating Keyboard Shortcuts with View Controllers

3.11 Recording the Screen and Sharing the Video

Chapter 4. Contacts

4.1 Creating Contacts

4.2 Searching for Contacts

4.3 Updating Contacts

4.4 Deleting Contacts

4.5 Formatting Contact Data

4.6 Picking Contacts with the Prebuilt System UI

4.7 Creating Contacts with Prebuilt System UI

4.8 Displaying Contacts with Prebuilt System UI

Chapter 5. Extensions

5.1 Creating Safari Content Blockers

5.2 Creating Shared Links for Safari

5.3 Maintaining Your App’s Indexed Content

Chapter 6. Web and Search

6.1 Making Your App’s Content Searchable

6.2 Making User Activities Searchable

6.3 Deleting Your App’s Searchable content

Chapter 7. Multitasking

7.1 Adding Picture in Picture Playback Functionality

7.2 Handling Low Power Mode and Providing Alternatives

Chapter 8. Maps and Location

8.1 Requesting the User’s Location a Single Time

8.2 Requesting the User’s Location in Background

8.3 Customizing the Tint Color of Pins on the Map

8.4 Providing Detailed Pin Information with Custom Views

8.5 Displaying Traffic, Scale and Compass Indicators on the Map

8.6 Providing an ETA for Transit Transport Type

8.7 Launching the iOS Maps App in Transit Mode

8.8 Showing Maps in Flyover Mode

Chapter 9. UI Testing

9.1 Preparing Your Project for UI Testing

9.2 Automating UI Test Scripts

9.3 Testing Text Fields, Buttons, and Labels

9.4 Finding UI Components

9.5 Long Pressing on UI Elements

9.6 Typing Inside Text Fields

9.7 Swiping on UI Elements

9.8 Tapping on UI Elements

Chapter 10. Core Motion

10.1 Querying Pace and Cadence Information

10.2 Recording and Reading Accelerometer Data

Chapter 11. Security

11.1 Protecting Your Network Connections with ATS

11.2 Binding Keychain Items to Passcode and Touch ID

11.3 Opening URLs Safely

11.4 Authenticating the User with Touch ID and Timeout

Chapter 12. Multimedia

12.1 Reading Out Text with the Default Siri Alex Voice

12.2 Downloading and Preparing Remote Media for Playback

12.3 Enabling Spoken Audio Sessions

Chapter 13. UI Dynamics

13.1 Adding a Radial Gravity Field to Your UI

13.2 Creating a Linear Gravity Field on Your UI

13.3 Creating Turbulence Effects with Animations

13.4 Adding Animated Noise Effects to Your UI

13.5 Creating a Magnetic Effect Between UI Components

13.6 Designing a Velocity Field on Your UI

13.7 Handling Non-Rectangular Views