Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Title Page
Copyright and Credits
Mastering iOS 12 Programming Third Edition
Dedication
Packt Upsell
Why subscribe?
Packt.com
Contributors
About the author
About the reviewers
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
UITableView Touch-up
Setting up the user interface
Fetching a user's contacts
Creating a custom UITableViewCell to show contacts
Designing a table-view cell
Creating the table-view cell subclass
Displaying the list of contacts
Protocols and delegation
Conforming to the UITableViewDataSource and UITableViewDelegate protocols
Under-the-hood performance of UITableView
Improving performance with prefetching
UITableViewDelegate and interactions
Responding to cell-selection
Implementing cell-deletion
Allowing the user to reorder cells
Summary
Questions
Further reading
A Better Layout with UICollectionView
Converting from a table view to a collection view
Creating and implementing a custom collection view cell
Understanding UICollectionViewFlowLayout and its delegate
Creating a custom UICollectionViewLayout
Pre-calculating the layout
Implementing collectionViewContentSize
Implementing layoutAttributesForElements(in:)
Implementing layoutAttributesForItem(at:)
Implementing shouldInvalidateLayout(forBoundsChange:)
Assigning a custom layout to your collection view
Final words on the custom layout
UICollectionView performance
Implementing user interactions for the collection view
Enabling cell selection for your collection view
Allowing users to delete cells
Reordering cells in a collection view
Refactoring the long-press handler
Implementing the reordering method calls
Implementing the data source methods
Adding the edit button
Summary
Questions
Further reading
Creating a Detail Page
Building universal applications
Implementing navigation with segues
Creating adaptive layouts with Auto Layout
Auto Layout with Interface Builder
Implementing a scroll view with Auto Layout
Laying out the image and name label
Adjusting the image and label for large screens
Laying out the bottom section
Adjusting the bottom section for small screens
Using Auto Layout in code
Implementing the compact size layout
Implementing the regular size layout
Improving layouts with UIStackView
Containing labels in a stack view
Passing data between view controllers
Updating the data loading and model
Passing the model to the details page
Implementing the new outlets and displaying data
Enhancing the user experience with 3D Touch
Summary
Questions
Further reading
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
Questions
Further reading
Understanding the Swift Type System
Knowing what types are available
Reference types
Value types
Understanding structs
Understanding enums
Understanding differences in types
Comparing value types to reference types
Differences in usage
Differences in memory allocation
Deciding which type you should use
When to use a reference type?
When to use a value type?
Summary
Questions
Further reading
Writing Flexible Code 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
Adding flexibility with generics
Summary
Questions
Further reading
Improving the Application Structure
Properly separating concerns
Extracting the contact-fetching code
Extracting the bounce animation
Adding protocols for clarity
Defining the ViewEffectAnimatorType protocol
Defining a contact-displayable protocol
Summary
Questions
Further reading
Adding Core Data to Your App
Understanding the Core Data Stack
Adding Core Data to an existing application
Creating a Core Data model
Creating the models
Defining relationships
Using your entities
Reading and writing data in a Core Data database
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 NSFetchedResultsController
Understanding the use of multiple instances of NSManagedObjectContext
Summary
Questions
Further reading
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 feature up
Adding the rating to the movie cell
Understanding App Transport Security
Observing changes to movie ratings
Summary
Questions
Further reading
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 capability
Asking iOS to wake your app
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
Test your knowledge
Further reading
Syncing Data with CloudKit
Getting familiar with CloudKit
Adding CloudKit to your project
Exploring the CloudKit dashboard
Understanding your CloudKit database
Exploring the rest of your container
Storing and retrieving data with CloudKit
Communicating with CloudKit for the first time
Listening for changes in the database
Retrieving changes from CloudKit
Configuring your AppDelegate
Storing data in CloudKit
Combining CloudKit and Core Data
Preparing the Core Data models for CloudKit
Importing CloudKit data
Sending Core Data models to CloudKit
Summary
Questions
Further reading
Using Augmented Reality
Understanding ARKit
Understanding how ARKit renders content
Understanding how ARKit tracks the physical environment
Using ARKit Quicklook
Implementing the ARKit Quicklook view controller
Exploring SpriteKit
Creating a SpriteKit scene
Exploring SceneKit
Creating a basic SceneKit scene
Implementing an Augmented Reality gallery
Adding image tracking
Preparing images for tracking
Building the image-tracking experience
Placing your own content in 3D space
Summary
Questions
Further reading
Improving Apps With Location Services
Requesting a user's location
Asking for permission to access location data
Obtaining a user's location
Subscribing to location changes
Setting up geofences
Summary
Questions
Further reading
Making Smarter Apps with CoreML
Understanding machine learning and 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
Training your own models with CreateML
Training a natural language model
Training a Vision model
Summary
Questions
Further reading
Tracking Activity Using HealthKit
Understanding HealthKit
Requesting access to the HealthKit Store
Storing and retrieving data with HealthKit
Implementing a workout app
Summary
Questions
Further reading
Streamlining Experiences with Siri
Understanding intents
Implementing an intents extension
Understanding app extensions
Configuring your extension
Adding vocabularies to your app
Adding vocabularies through a .plist file
Teaching Siri new 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
Implementing Siri Shortcuts
Implementing shortcuts through NSUserActivity
Donating shortcuts with INinteractions
Summary
Questions
Further reading
Using Media in Your App
Playing audio and video
Creating a simple video player
Creating an audio player
Implementing basic audio controls
Implementing the time scrubber
Displaying song metadata
Playing media in the background
Recording video and taking pictures
Taking and storing a picture
Recording and storing video
Manipulating photos with Core Image
Summary
Questions
Further reading
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 grouped notifications
Grouping notifications based on thread identifiers
Providing a custom summary message for your notification group
Implementing notification extensions
Adding a service extension to your app
Adding a content extension to your app
Summary
Questions
Further reading
Instant Information with a Today Extension
Understanding the anatomy of a Today Extension
Finding Today Extensions in iOS
Understanding Today Extensions
Adding a Today Extension to your app
Summary
Questions
Further reading
Exchanging Data With Drag And Drop
Understanding the drag and drop experience
Understanding UIDragInteractionDelegate
Understanding UIDropInteractionDelegate
Implementing a 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
Questions
Further reading
Improved 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 ratings
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
Questions
Further reading
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
Questions
Further reading
Ensuring App Quality with Tests
Testing logic with XCTest
Understanding what it means to test code
Determining which tests to write
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
Questions
Further reading
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
Creating your own Instrument
Adding signpost logging to your app
Building an Instruments Package
Summary
Questions
Further reading
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
Questions
Further reading
Submitting Your App to the App Store
Adding your application to App Store Connect
Packaging and uploading your app for beta testing
Preparing your app for launch
Summary
Questions
Further reading
Answers
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6 
Chapter 7 
Chapter 8 
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
Chapter 15
Chapter 16
Chapter 17
Chapter 18 
Chapter 19
Chapter 20
Chapter 21
Chapter 22
Chapter 23
Chapter 24
Chapter 25 
Chapter 26 
Other Books You May Enjoy
Leave a review - let other readers know what you think
← Prev
Back
Next →
← Prev
Back
Next →