Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Title Page
Second Edition
Copyright
Mastering iOS 11 Programming
Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Why subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
UITableView Touch Up
Setting up the user interface (UI)
Fetching a user's contacts
Creating a custom UITableViewCell for our contacts
Designing the contact cell
Creating the cell subclass
Displaying the list of contacts
Protocols and delegation
Conforming to the UITableViewDataSource and UITableViewDelegate protocol
Under the hood of UITableView performance
Improving performance with prefetching
UITableViewDelegate and interactions
Responding to cell selection
Implementing cell deletion
Allowing the user to reorder cells
Summary
A Better Layout with UICollectionView
Converting from a UITableView to UICollectionView
Creating and implementing a custom UICollectionViewCell
Understanding the UICollectionViewFlowLayout and its delegate
Creating a custom UICollectionViewLayout
Precalculating the layout
Implementing collectionViewContentSize
Implementing layoutAttributesForElements(_:)
Implementing layoutAttributesForItem(_:)
Implementing shouldInvalidateLayout(_:)
Assigning the custom layout to the collection view
Final words on the custom layout
UICollectionView performance
User interactions with UICollectionView
Cell selection
Cell deletion
Cell reordering
Refactoring the long-press handler
Implementing the reorder method calls
Implementing the data source methods
Adding the edit button
Summary
Creating a Contact Details Page
Universal applications
Implementing navigation with segues
Creating adaptive layouts with Auto Layout
Auto Layout with Interface Builder
Adding a scroll view to make the layout scrollable
Laying out the image and name label
Adjusting the image and name label for large screens
Laying out the bottom section
Adjust the bottom section for small screens
Auto Layout in code
Implementing the compact size layout
Implementing the regular size layout
Easier layouts with UIStackView
Containing labels in a UIStackView
Varying columns and layouts for traits in UIStackView
Passing data between view controllers
Updating the data loading and model
Passing the model to the detail page
Implementing new outlets and display data
Previewing content using 3D Touch
Summary
Immersing Your Users with Animation
Refactoring existing animations with UIViewPropertyAnimator
Understanding and controlling animation progress
Adding vibrancy to animations
Adding dynamism with UIKit Dynamics
Customizing view controller transitions
Implementing a custom modal presentation transition
Making an interactive dismissal transition
Implementing a custom UINavigationController transition
Summary
Improving Your Code with Value Types
Understanding reference types
Understanding value types
Differences between values and references in usage
Memory differences between values and references
Heap allocation
Stack allocation
Using structs to improve your code
Starting your models as structs
Using a struct if you don't need inheritance
Enforcing immutability with structs
Final words on structs
Containing information in enums
Summary
Making Your Code More Flexible with Protocols and Generics
Defining your own protocols
Checking for traits instead of types
Extending your protocols with default behavior
Improving your protocols with associated types
Summary
Refactoring the HelloContacts Application
Properly separating concerns
Extracting the contact-fetching code
Extracting the bounce animation
Adding protocols for clarity
Defining the ViewEffectAnimatorType protocol
Defining a contact display protocol
Summary
Adding Core Data to Your App
Understanding the Core Data stack
Adding Core Data to an application
Modeling data in the model editor
Creating the models
Defining relationships
Creating NSManagedObject subclasses
Summary
Storing and Querying Data in Core Data
Storing data with Core Data
Understanding data persistence
Persisting your models
Refactoring the persistence code
Reading data with a simple fetch request
Filtering data with predicates
Reacting to database changes
Implementing a NSFetchedResultsController
Understanding the use of multiple NSManagedObjectContexts
Summary
Fetching and Displaying Data from the Network
Fetching data from the web
Understanding URLSession basics
Working with JSON in Swift
Updating Core Data objects with fetched data
Implementing the fetch logic
Updating a movie with a popularity rating
Visualizing multiple threads
Wrapping the features up
Adding the rating to the movie cell
Understanding App Transport Security
Observing changes to movie ratings
Summary
Being Proactive with Background Fetch
Understanding how background fetch works
Looking at background fetch from a distance
Looking at background fetch in more depth
Implementing the prerequisites for background fetch
Adding the background fetch capabilities
Asking iOS to wake our app up
Updating movies in the background
Updating the data model
Refactoring the existing code
Updating movies in the background
Preparing the helper struct
Updating the movies
Summary
Enriching Apps with the Camera, Motion, and Location
Accessing and using the camera the simple way
Exploring the AVFoundation framework
Playing audio with AVFoundation
Playing video with AVFoundation
Rendering the camera feed
Understanding the building blocks of a video feed
Implementing the video feed
Implementing CoreMotion
Tracking walks with the pedometer
Reading sensor data with CoreMotion
Creating the login interface
Using CoreLocation to locate your users
Obtaining a user's location
Providing location-based updates with geofencing
Tracking the user's location while they're on the move
Finishing the ArtApp login screen
Summary
Extending the World with ARKit
Understanding how ARKit works
Making sense of the world
Understanding scenes
Rendering a scene
Using ARKit with SceneKit
Using ARKit with SpriteKit
Exploring SpriteKit
Setting up a SpriteKit scene
Implementing an Augmented Reality gallery
Enabling ARKit in an existing project
Summary
Exchanging Data with Drag and Drop
Understanding the drag and drop experience
Understanding UIDragInteractionDelegate
Understanding UIDropInteractionDelegate
Implementing basic drag and drop functionality
Adding drag and drop to a plain UIView
Adding drag and drop to a UICollectionView
Customizing the drag and drop experience
Summary
Making Smarter Apps with CoreML
Understanding what machine learning is
Understanding CoreML
Obtaining CoreML models
Using a CoreML model
Combining CoreML and computer vision
Understanding the Vision framework
Implementing an image classifier
Summary
Increasing Your App's Discoverability with Spotlight and Universal Links
Understanding Spotlight search
Adding your app contents to the Spotlight index
Indexing your app through user activity
Indexing with CSSearchableItem
Containing information in CSSearchableItemAttributeSet
Adding CSSearchableItem instances to the search index
Safely combining indexing methods
Handling searchable item selection
Understanding Spotlight best practices and rating
Adding metadata to your web links
Registering as an indexing delegate
Increasing your app's visibility with Universal Links
Preparing your server for Universal Links
Handling Universal Links in your app
Summary
Instant Information with a Notification Center Widget
Understanding the anatomy of a Today Extension
Understanding app extensions
Understanding Today Extensions
Adding a Today Extension to your app
Discovering your widget
Sharing data with App Groups
Summary
Implementing Rich Notifications
Gaining a deep understanding of notifications
Scheduling and handling notifications
Registering for notifications
Creating notification contents
Creating push notifications
Creating local notifications
Scheduling your notification
Scheduling a timed notification
Scheduling a calendar-based notification
Scheduling a location-based notification
Handling notifications
Handling notifications in your app
Managing pending and delivered notifications
Adding actions to notifications
Implementing Notification Extensions
Adding a Service Extension to your app
Adding a Content Extension to your app
Summary
Extending iMessage
Understanding iMessage apps
Creating an iMessage sticker pack
Optimizing assets for your stickers
Creating a custom sticker app
Implementing custom, interactive iMessage apps
Understanding the iMessage app life cycle
Implementing the custom compact view
Implementing the expanded view
Understanding sessions, messages, and conversations
Composing a message
Sending a message
Summary
Integrating Your App with Siri
Understanding intents and vocabularies
Adding intents to your extension
Adding vocabularies to your app
Adding vocabularies through a .plist file
Teaching Siri vocabularies at runtime
Handling intents in your extension
Resolving the user's input
Confirming the intent status
Performing the desired action
Adding a custom UI to Siri
Summary
Ensuring App Quality with Tests
Testing logic with XCTest
Understanding what it means to test code
Determining what to test
Choosing the correct test type
Unit tests
Integration tests
Isolating tests
Arrange
Act
Assert
Setting up a test suite with XCTest
Optimizing code for testability
Introducing the question loader
Mocking API responses
Using models for consistency
Gaining insights through code coverage.
Testing the user interface with XCUITest
Making your app accessible to your tests
Recording UI tests
Passing launch arguments to your app
Making sure the UI updates as expected
Summary
Discovering Bottlenecks with Instruments
Exploring the Instruments suite
Discovering slow code
Closing memory leaks
Understanding what a memory leak is
Preventing objects from using infinite memory
Avoiding reference cycles
Discovering memory leaks
Summary
Offloading Tasks with Operations and GCD
Writing asynchronous code
Understanding threads
Using dispatch queues in your application
Creating reusable tasks with Operations
Using Operations in your apps
Summary
Wrapping Up the Development Cycle and Submitting to the App Store
Adding your application to iTunes Connect
Packaging and uploading your app for beta testing
Preparing your app for launch
Summary
← Prev
Back
Next →
← Prev
Back
Next →