0%

Become a professional iOS developer with the most in-depth and advanced guide to Swift 5.3, Xcode 12.4, ARKit 4, Core ML, and iOS 14's new features

Key Features

  • Explore the world of iOS app development through practical examples
  • Understand core iOS programming concepts such as Core Data, networking, and the Combine framework
  • Extend your iOS apps by adding augmented reality and machine learning capabilities, widgets, App Clips, Dark Mode, and animations

Book Description

Mastering iOS 14 development isn't a straightforward task, but this book can help you do just that. With the help of Swift 5.3, you'll not only learn how to program for iOS 14 but also be able to write efficient, readable, and maintainable Swift code that reflects industry best practices.

This updated fourth edition of the iOS 14 book will help you to build apps and get to grips with real-world app development flow. You'll find detailed background information and practical examples that will help you get hands-on with using iOS 14's new features. The book also contains examples that highlight the language changes in Swift 5.3. As you advance through the chapters, you'll see how to apply Dark Mode to your app, understand lists and tables, and use animations effectively. You'll then create your code using generics, protocols, and extensions and focus on using Core Data, before progressing to perform network calls and update your storage and UI with the help of sample projects. Toward the end, you'll make your apps smarter using machine learning, streamline the flow of your code with the Combine framework, and amaze users by using Vision framework and ARKit 4.0 features.

By the end of this iOS development book, you'll be able to build apps that harness advanced techniques and make the best use of iOS 14's features.

What you will learn

  • Build a professional iOS application using Xcode 12.4 and Swift 5.3
  • Create impressive new widgets for your apps with iOS 14
  • Extend the audience of your app by creating an App Clip
  • Improve the flow of your code with the Combine framework
  • Enhance your app by using Core Location
  • Integrate Core Data to persist information in your app
  • Train and use machine learning models with Core ML
  • Create engaging augmented reality experiences with ARKit 4 and the Vision framework

Who this book is for

This book is for developers with some experience in iOS programming who want to enhance their application development skills by unlocking the full potential of the latest iOS version with Swift.

Table of Contents

  1. Mastering iOS 14 Programming
  2. Fourth Edition
  3. Contributors
  4. About the authors
  5. About the reviewers
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Reviews
  7. Chapter 1: What's New in iOS 14?
    1. Technical requirements
    2. Introducing App Clips
    3. App Clip user journey
    4. App Clips invocation methods
    5. App Clips guidelines
    6. Introducing WidgetKit
    7. Widgets options
    8. Widget guidelines
    9. Improvements in augmented reality
    10. Improvements in machine learning
    11. Core ML Model Deployment, collections, and targeted deployments
    12. Model encryption
    13. Improvements in user privacy
    14. Introducing Swift 5.2
    15. Key path expressions as functions
    16. Callable values of user-defined nominal types
    17. Subscripts can now declare default arguments
    18. Lazy filtering order is now reversed
    19. New and improved diagnostics
    20. Introducing Swift 5.3
    21. Multi-pattern catch clauses
    22. Multiple trailing closures
    23. Synthesized comparable conformance for enum types
    24. Increase availability of implicit self in escaping closures when reference cycles are unlikely to occur
    25. Type-based program entry points – @main
    26. Use where clauses on contextually generic declarations
    27. Enum cases as protocol witnesses
    28. Refine didSet semantics
    29. Float16
    30. Summary
    31. Further reading
  8. Chapter 2: Working with Dark Mode
    1. Technical requirements
    2. What is Dark Mode?
    3. Understanding why we would need Dark Mode
    4. Core developer concepts of Dark Mode
    5. Dark mode from inside Xcode
    6. Working with views in Dark Mode
    7. What are adaptive colors?
    8. What are semantic colors?
    9. Using the programmatic approach
    10. Working with the asset catalog for Dark Mode
    11. Using custom adaptive colors
    12. Using custom adaptive images
    13. Further exploring Dark Mode
    14. Using Dark Mode with SwiftUI
    15. Programatically handling changes with trait collection
    16. Specifying an appearance for views, ViewControllers, and windows
    17. Accessibility in Dark Mode
    18. Summary
    19. Further reading
  9. Chapter 3: Using Lists and Tables
    1. Technical requirements
    2. Working with UITableView
    3. Setting up the project
    4. Fetching contacts data
    5. Prepping UITableView to display our contacts
    6. Understanding protocols and delegation
    7. Conforming to the UITableView protocols
    8. Understanding the custom UITableViewCell override and the reuse identifier
    9. Exploring UITableView further
    10. Further understanding reuse identifiers
    11. Prefetching in table views
    12. Cell selection in table views
    13. Working with UICollectionView
    14. Setting up our collection view
    15. Implementing layout with UICollectionViewDelegateFlowLayout
    16. Exploring UICollectionView further
    17. Implementing a custom UICollectionViewLayout
    18. Cell selection in collection views
    19. Working with lists in SwiftUI
    20. Creating our first SwiftUI project
    21. Building a list in SwiftUI
    22. The equivalent to creating a custom cell in SwiftUI
    23. Summary
    24. Further reading
  10. Chapter 4: Creating a Detail Page
    1. Technical requirements
    2. Implementing navigation with segues
    3. Creating our new details view
    4. Implementing and understanding segues
    5. Creating a manual segue
    6. Creating our layouts with UIStackView
    7. Containing labels in a stack view
    8. Passing data between view controllers
    9. Updating the data loading
    10. Passing the model to the details page
    11. Updating our outlets
    12. Best practices – creating a view model
    13. Summary
    14. Further reading
  11. Chapter 5: Immersing Your Users with Animation
    1. Technical requirements
    2. Using UIView.animate and UIViewPropertyAnimator
    3. Creating our first animation
    4. Working with multiple animations
    5. Refactoring with UIViewPropertyAnimator
    6. Understanding and controlling animation progress
    7. Interactions with a pan gesture recognizer
    8. Adding vibrancy to animations
    9. Adding dynamism with UIKit Dynamics
    10. Customizing view controller transitions
    11. Implementing a custom modal presentation transition
    12. Summary
  12. Chapter 6: Understanding the Swift Type System
    1. Technical requirements
    2. Understanding available types in Swift
    3. Working with reference types
    4. Working with value types
    5. Understanding structs
    6. Understanding enums
    7. Understanding differences in types
    8. Comparing value types to reference types
    9. Differences in usage
    10. Deciding which type to use
    11. When should I use a reference type?
    12. When to use a value type
    13. Summary
  13. Chapter 7: Flexible Code with Protocols, Generics, and Extensions
    1. Technical requirements
    2. Understanding and implementing protocols
    3. Defining your own protocols
    4. Checking for traits instead of types
    5. Extending your protocols with default behavior
    6. Improving your protocols with associated types
    7. Adding flexibility with generics
    8. Summary
  14. Chapter 8: Adding Core Data to Your App
    1. Technical requirements
    2. Understanding the Core Data stack
    3. Adding Core Data to an existing application
    4. Creating a Core Data model
    5. Creating the models
    6. Defining relationships
    7. Using your entities
    8. Persisting data and reacting to data changes
    9. Understanding data persistence
    10. Persisting your models
    11. Refactoring the persistence code
    12. Reading data with a simple fetch request
    13. Filtering data with predicates
    14. Reacting to database changes
    15. Understanding the use of multiple instances of NSManagedObjectContext
    16. Refactoring the persisting code
    17. Summary
    18. Further reading
  15. Chapter 9: Fetching and Displaying Data from the Network
    1. Technical requirements
    2. Fetching data from the web with URLSession
    3. Understanding the basics of URLSession
    4. Working with JSON in Swift
    5. Updating Core Data objects with fetched data
    6. Implementing the fetch logic
    7. Updating a movie with a popularity rating
    8. Visualizing multiple threads
    9. Summary
  16. Chapter 10: Making Smarter Apps with Core ML
    1. Technical requirements
    2. Understanding machine learning and Core ML
    3. Understanding what machine learning is
    4. Understanding Core ML
    5. Combining Core ML and computer vision
    6. Understanding the Vision framework
    7. Implementing an image classifier
    8. Training your own models with Create ML
    9. Training a Natural Language model
    10. Training a Vision model
    11. Updating models remotely with Model Deployment
    12. Using the Core ML API to retrieve collections of models
    13. Preparing and deploying the model
    14. Encrypting Core ML models
    15. Summary
  17. Chapter 11: Adding Media to Your App
    1. Technical requirements
    2. Playing audio and video
    3. Creating a simple video player
    4. Creating an audio player
    5. Playing media in the background
    6. Recording video and taking pictures
    7. Taking and storing a picture
    8. Recording and storing video
    9. Manipulating photos with Core Image
    10. Summary
  18. Chapter 12: Improving Apps with Location Services
    1. Technical requirements
    2. Requesting a user's location
    3. Asking for permission to access location data
    4. Obtaining a user's location
    5. Subscribing to location changes
    6. Setting up geofences
    7. Summary
  19. Chapter 13: Working with the Combine Framework
    1. Technical requirements
    2. Understanding the Combine framework
    3. Understanding Publisher
    4. Understanding Subscriber
    5. Understanding Operators
    6. Understanding Subject
    7. Combining Publishers, Subscribers, and Operators
    8. Using Operators to build error-proof streams
    9. Summary
  20. Chapter 14: Creating an App Clip for Your App
    1. Technical requirements
    2. Introducing App Clips
    3. App Clip User Journey
    4. App Clips Invocation Methods
    5. Developing your first App Clip
    6. Creating the App Clip's Target
    7. Sharing resources and code with the App Clip
    8. Using Active Compilation Conditions
    9. Configuring, linking, and triggering your App Clip
    10. Testing your App Clip Experiences
    11. Summary
  21. Chapter 15: Recognition with Vision Framework
    1. Technical requirements
    2. Introduction to the Vision framework
    3. Recognizing text in images
    4. Region of interest
    5. Recognizing hand landmarks in real time
    6. Understanding hand landmarks
    7. Implementing hand detection
    8. Summary
  22. Chapter 16: Creating Your First Widget
    1. Technical requirements
    2. Introducing widgets and WidgetKit
    3. Widget options
    4. Widget guidelines
    5. Developing your first widget
    6. Creating a widget extension
    7. Implementing multiple-size widgets
    8. Providing the widget with data and configuration
    9. Refreshing the widget's data
    10. Summary
  23. Chapter 17: Using Augmented Reality
    1. Understanding ARKit
    2. Understanding how ARKit renders content
    3. Understanding how ARKit tracks the physical environment
    4. Using ARKit Quick Look
    5. Implementing the ARKit Quick Look view controller
    6. Exploring SpriteKit
    7. Creating a SpriteKit scene
    8. Exploring SceneKit
    9. Creating a basic SceneKit scene
    10. Implementing an Augmented Reality gallery
    11. Adding image tracking
    12. Preparing images for tracking
    13. Building the image tracking experience
    14. Placing your own content in 3D space
    15. Summary
  24. Chapter 18: Creating a macOS app with Catalyst
    1. Technical requirements
    2. Discovering Mac Catalyst
    3. Exploring new Mac Catalyst features
    4. Building your first Mac Catalyst app
    5. Exploring the iPad app
    6. Scaling your iPad app for Mac
    7. Optimizing your iPad app for Mac
    8. Summary
  25. Chapter 19: Ensuring App Quality with Tests
    1. Testing logic with XCTest
    2. Understanding what it means to test code
    3. Setting up a test suite with XCTest
    4. Optimizing code for testability
    5. Introducing the question loader
    6. Mocking API responses
    7. Using models for consistency
    8. Gaining insights through code coverage
    9. Testing the user interface with XCUITest
    10. Making your app accessible to your tests
    11. Recording UI tests
    12. Passing launch arguments to your app
    13. Making sure the UI updates as expected
    14. Summary
  26. Chapter 20: Submitting Your App to the App Store
    1. Adding your application to App Store Connect
    2. Packaging and uploading your app for beta testing
    3. Preparing your app for launch
    4. Summary
    5. Why subscribe?
  27. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Leave a review - let other readers know what you think