1 UIKit Dynamics 1 The Sample App 1Introduction to UIKit Dynamics 2Implementing UIKit Dynamics 3Gravity 3Collisions 4Attachments 7Springs 8Snap 9Push Forces 10Item Properties 11In-Depth UIDynamicAnimator and UIDynamicAnimatorDelegate 13Summary 14 2 Core Location, MapKit, and Geofencing 15 The Sample App 15Obtaining User Location 16Requirements and Permissions 16Checking for Services 19Starting Location Request 19Parsing and Understanding Location Data 22Significant Change Notifications 23Using GPX Files to Test Specific Locations 23Displaying Maps 25Understanding the Coordinate Systems 25MKMapKit Configuration and Customization 25Responding to User Interactions 27Map Annotations and Overlays 28Adding Annotations 28Displaying Standard and Custom Annotation Views 31Draggable Annotation Views 34Working with Map Overlays 35Geocoding and Reverse-Geocoding 36Geocoding an Address 36Reverse-Geocoding a Location 40Geofencing 43Checking for Regional Monitoring Capability 43Defining Boundaries 44Monitoring Changes 45Getting Directions 47Summary 52 3 Leaderboards 53 The Sample App 53Spawning a Cactus 55Cactus Interaction 58Displaying Life and Score 60Pausing and Resuming 62Final Thoughts on Whack-a-Cac 63iTunes Connect 63Game Center Manager 66Authenticating 68Common Authentication Errors 69iOS 6 and Newer Authentication 71Submitting Scores 73Adding Scores to Whack-a-Cac 76Presenting Leaderboards 77Score Challenges 79Going Further with Leaderboards 81Summary 83 4 Achievements 85 iTunes Connect 85Displaying Achievement Progress 87Game Center Manager and Authentication 88The Achievement Cache 89Reporting Achievements 90Adding Achievement Hooks 92Completion Banners 93Achievement Challenges 94Adding Achievements into Whack-a-Cac 97Earned or Unearned Achievements 98Partially Earned Achievements 99Multiple Session Achievements 101Piggybacked Achievements and Storing Achievement Precision 102Timer-Based Achievements 103Resetting Achievements 104Going Further with Achievements 105Summary 107 5 Getting Started with Address Book 109 Why Address Book Support Is Important 109Limitations of Address Book Programming 110The Sample App 110Getting Address Book Up and Running 111Reading Data from the Address Book 113Reading Multivalues from the Address Book 114Understanding Address Book Labels 115Working with Addresses 116Address Book Graphical User Interface 118People Picker 118Programmatically Creating Contacts 123Summary 126 6 Working with Music Libraries 127 The Sample App 127Building a Playback Engine 129Registering for Playback Notifications 129User Controls 131Handling State Changes 132Duration and Timers 137Shuffle and Repeat 138Media Picker 138Programmatic Picker 141Playing a Random Song 141Predicate Song Matching 142Summary 144 7 Implementing HealthKit 145 Introduction to HealthKit 145Introduction to Health.app 146The Sample App 147Adding HealthKit to a Project 148Requesting Permission for Health Data 149Reading Characteristic HealthKit Data 152Reading and Writing Basic HealthKit Data 152Reading and Writing Complex HealthKit Data 155Summary 160 8 Implementing HomeKit 161 The Sample App 161Introduction to HomeKit 162Setting Up HomeKit Components 162Developer Account Setup 163Enabling HomeKit Capability 163Home Manager 164Home 166Rooms and Zones 168Accessories 170Services and Service Groups 176Actions and Action Sets 178Testing with the HomeKit Accessory Simulator 179Scheduling Actions with Triggers 181Summary 181 9 Working with and Parsing JSON 183 JSON 183Benefits of Using JSON 183JSON Resources 184The Sample App 184Accessing the Server 184Getting JSON from the Server 185Building the Request 185Inspecting the Response 186Parsing JSON 186Displaying the Data 187Posting a Message 189Encoding JSON 189Sending JSON to the Server 191Summary 193 10 Notifications 195 Differences Between Local and Push Notifications 195The Sample App 196App Setup 196Creating Development Push SSL Certificate 200Development Provisioning Profile 203Custom Sound Preparation 208Registering for Notifications 209Scheduling Local Notifications 211Receiving Notifications 212Push Notification Server 213Sending the Push Notifications 214Handling APNs Feedback 215Summary 216 11 Cloud Persistence with CloudKit 217 CloudKit Basics 217The Sample App 218Setting Up a CloudKit Project 218Account Setup 218Enabling iCloud Capabilities 220CloudKit Concepts 220Containers 220Databases 221Records 221Record Zones 222Record Identifiers 222Assets 222CloudKit Basic Operations 222Fetching Records 223Create and Save a Record 224Update and Save a Record 226Subscriptions and Push 227Push Setup 227Subscribing to Data Changes 227User Discovery and Management 229Managing Data in the Dashboard 233Summary 235 12 Extensions 237 Types of Extensions 237Today 237Share 238Action 238Photo Editing 238Document Provider 238Custom Keyboard 238Understanding Extensions 238API Limitations 239Creating Extensions 240Today Extension 242Sharing Code and Information between Host App and Extension 243Apple Watch Extension 244Summary 247 13 Handoff 249 The Sample App 249Handoff Basics 249Implementing Handoff 251Creating the User Activity 252Continuing an Activity 253Implementing Handoff in Document-Based Apps 255Summary 257 14 AirPrint 259 AirPrint Printers 259Testing for AirPrint 261Printing Text 261Print Info 262Setting Page Range 263UISimpleTextPrintFormatter 263Error Handling 264Starting the Print Job 264Printer Simulator Feedback 265Print Center 266UIPrintInteractionControllerDelegate 267Printing Rendered HTML 268Printing PDFs 269Summary 270 15 Getting Up and Running with Core Data 271 Deciding on Core Data 272Sample App 273Starting a Core Data Project 274Core Data Environment 275Building Your Managed Object Model 278Creating an Entity 280Adding Attributes 280Establishing Relationships 281Custom Managed Object Subclasses 282Setting Up Default Data 282Inserting New Managed Objects 282Other Default Data Setup Techniques 284Displaying Your Managed Objects 285Creating Your Fetch Request 285Fetching by Object ID 287Displaying Your Object Data 288Using Predicates 290Introducing the Fetched Results Controller 292Preparing the Fetched Results Controller 292Integrating Table View and Fetched Results Controller 294Responding to Core Data Changes 296Adding, Editing, and Removing Managed Objects 299Inserting a New Managed Object 299Removing a Managed Object 300Editing an Existing Managed Object 301Saving and Rolling Back Your Changes 301Summary 303 16 Integrating Twitter and Facebook Using Social Framework 305 The Sample App 305Logging In 306Using SLComposeViewController 308Posting with a Custom Interface 311Posting to Twitter 311Posting to Facebook 315Creating a Facebook App 315Accessing User Timelines 322Twitter 322Facebook 327Summary 331 17 Working with Background Tasks 333 The Sample App 334Checking for Background Availability 334Finishing a Task in the Background 335Background Task Identifier 336Expiration Handler 337Completing the Background Task 337Implementing Background Activities 339Types of Background Activities 339Playing Music in the Background 340Summary 344 18 Grand Central Dispatch for Performance 345 The Sample App 345Introduction to Queues 347Running on the Main Thread 347Running in the Background 349Running in an Operation Queue 351Concurrent Operations 351Serial Operations 353Canceling Operations 354Custom Operations 355Running in a Dispatch Queue 357Concurrent Dispatch Queues 357Serial Dispatch Queues 359Summary 361 19 Using Keychain and Touch ID to Secure and Access Data 363 The Sample App 364Setting Up and Using Keychain 364Setting Up a New KeychainItemWrapper 365Storing and Retrieving the PIN 366Keychain Attribute Keys 367Securing a Dictionary 368Resetting a Keychain Item 370Sharing a Keychain Between Apps 370Keychain Error Codes 372Implementing Touch ID 372Summary 374 20 Working with Images and Filters 375 The Sample App 375Basic Image Data and Display 376Instantiating an Image 376Displaying an Image 377Using the Image Picker 379Resizing an Image 382Core Image Filters 383Filter Categories and Filters 383Filter Attributes 386Initializing an Image 388Rendering a Filtered Image 389Chaining Filters 390Feature Detection 391Setting Up a Face Detector 391Processing Face Features 392Summary 394 21 Collection Views 395 The Sample App 395Introducing Collection Views 396Setting Up a Collection View 397Implementing the Collection View Data Source Methods 398Implementing the Collection View Delegate Methods 401Customizing Collection View and Flow Layout 403Basic Customizations 403Decoration Views 405Creating Custom Layouts 408Collection View Animations 413Collection View Layout Changes 413Collection View Layout Animations 414Collection View Change Animations 416Summary 417 22 Introduction to TextKit 419 The Sample App 420Introducing NSLayoutManager 420Detecting Links Dynamically 423Detecting Hits 424Exclusion Paths 425Content Specific Highlighting 427Changing Font Settings with Dynamic Type 432Summary 433 23 Gesture Recognizers 435 Types of Gesture Recognizers 435Basic Gesture Recognizer Usage 436Introduction to the Sample App 437Tap Recognizer in Action 438Pinch Recognizer in Action 440Multiple Recognizers for a View 441Gesture Recognizers: Under the Hood 443Multiple Recognizers for a View: Redux 444Requiring Gesture Recognizer Failures 446Custom UIGestureRecognizer Subclasses 448Summary 448 24 Accessing the Photo Library 449 The Sample App 449The Photos Framework 450Using Asset Collections and Assets 451Permissions 451Asset Collections 453Assets 457Changes in the Photo Library 459Asset Collection Changes 459Asset Changes 462Dealing with Photo Stream 464Summary 465 25 Passbook and PassKit 467<.
Mastering IOS Frameworks : Beyond the Basics