
iOS 15 Programming for Beginners - Sixth Edition
With almost 2 million apps on the App Store, iOS mobile apps continue to be incredibly popular. Anyone can reach millions of customers around the world by publishing their apps on the App Store. iOS 15 Programming for Beginners is a comprehensive introduction for those who are new to iOS. It covers the entire process of learning the Swift language, writing your own app, and publishing it on the App Store.
Complete with hands-on tutorials, projects, and self-assessment questions, this easy-to-follow guide will help you get well-versed with the Swift language to build your apps and introduce exciting new technologies that you can incorporate into your apps. You'll learn how to publish iOS apps and work with Mac Catalyst, SharePlay, SwiftUI, Swift concurrency, and much more.
By the end of this iOS development book, you'll have the knowledge and skills to write and publish interesting apps, and more importantly, to use the online resources available to enhance your app development journey.
- iOS 15 Programming for Beginners
- Sixth Edition
- Contributors
- About the authors
- About the reviewers
- Preface
- Who this book is for
- What this book covers
- To get the most out of this book
- Download the example code files
- Code in Action
- Download the color images
- Conventions used
- Get in touch
- Share Your Thoughts
- Part 1: Swift
- Chapter 1: Getting Familiar with Xcode
- Technical requirements
- Downloading and installing Xcode from the App Store
- Understanding the Xcode user interface
- Running the app in the iOS simulator
- Understanding the No Devices and Build sections
- Using an iOS device for development
- Trusting the Developer App certificate on your iOS device
- Connecting an iOS device wirelessly
- Summary
- Invitation to join us on Discord
- Chapter 2: Simple Values and Types
- Technical requirements
- Understanding Swift playgrounds
- Customizing fonts and colors
- Running playground code
- Exploring data types
- Representing integers
- Representing floating-point numbers
- Representing Booleans
- Representing strings
- Using common data types in the playground
- Exploring constants and variables
- Understanding type inference and type safety
- Using type annotation to specify a type
- Using type safety to check values
- Exploring operators
- Using arithmetic operators
- Using compound assignment operators
- Using comparison operators
- Using logical operators
- Performing string operations
- Using the print() statement
- Summary
- Chapter 3: Conditionals and Optionals
- Technical requirements
- Introducing conditionals
- Using if statements
- Using switch statements
- Introducing optionals and optional binding
- Summary
- Chapter 4: Range Operators and Loops
- Technical requirements
- Exploring Range operators
- Exploring Loops
- Using the for-in loop
- Using the while loop
- The repeat-while loop
- Summary
- Chapter 5: Collection Types
- Technical requirements
- Understanding arrays
- Creating an array
- Checking the number of elements in an array
- Adding a new element to an array
- Accessing an array element
- Assigning a new value to a particular index
- Removing an element from an array
- Iterating over an array
- Understanding dictionaries
- Creating a dictionary
- Checking the number of elements in a dictionary
- Adding a new element to a dictionary
- Accessing a dictionary element
- Assigning a new value to an existing key
- Removing an element from a dictionary
- Iterating over a dictionary
- Understanding sets
- Creating a set
- Checking the number of elements in a set
- Adding a new element to a set
- Checking whether a set contains an element
- Removing an item from a set
- Iterating over a set
- Exploring Set operations
- Exploring set membership and equality
- Summary
- Chapter 6: Functions and Closures
- Technical requirements
- Understanding functions
- Creating a function
- Using custom argument labels
- Using nested functions
- Using functions as return types
- Using functions as parameters
- Using a guard statement to exit a function early
- Understanding closures
- Simplifying closures
- Summary
- Chapter 7: Classes, Structures, and Enumerations
- Technical requirements
- Understanding classes
- Creating a class declaration
- Making an instance of the class
- Making a subclass
- Overriding a superclass method
- Understanding structures
- Creating a structure declaration
- Making an instance of the structure
- Comparing value types and reference types
- Deciding between classes and structures
- Understanding enumerations
- Creating an enumeration
- Summary
- Chapter 8: Protocols, Extensions, and Error Handling
- Technical requirements
- Understanding protocols
- Creating a protocol declaration
- Understanding extensions
- Adopting a protocol via an extension
- Creating an array of different types of objects
- Exploring error handling
- Summary
- Part 2: Design
- Chapter 9: Setting Up the User Interface
- Technical requirements
- Learning useful terms in iOS development
- Touring the Lets Eat app
- Using the Explore screen
- Using the Locations screen
- Using the Restaurant List screen
- Using the Restaurant Detail screen
- Using the Review Form screen
- Using the Photo Filter screen
- Using the Map screen
- Creating a new Xcode project
- Setting up a tab bar controller scene
- Setting the titles of the tab bar's buttons
- Embedding view controllers in navigation controllers
- Adding the Assets.xcassets file
- Adding the icons for the Explore and Map buttons
- Setting up the Launch screen
- Configuring the Launch screen's background color
- Adding a logo and constraints to the Launch screen
- Configuring Interface Builder
- Summary
- Invitation to join us on Discord
- Chapter 10: Building Your User Interface
- Technical requirements
- Adding a collection view to the Explore screen
- Connecting storyboard elements to outlets in a view controller
- Adding a Cocoa Touch Class file to your project
- Connecting storyboard elements to the view controller
- Configuring data source methods for the collection view
- Setting the delegate and data source properties of the collection view
- Adopting the UICollectionViewDataSource and UICollectionViewDelegate protocols
- Adding a section header to the collection view
- Configuring storyboard element sizes
- Presenting a view modally
- Adding a button to the collection view header
- Adding a new view controller scene
- Adding Cancel and Done buttons to the navigation bar
- Summary
- Chapter 11: Finishing Up Your User Interface
- Technical requirements
- Adding a table view to the Locations screen
- Implementing the Restaurant List screen
- Declaring the RestaurantListViewController class
- Adopting the delegate and data source protocols
- Presenting the Restaurant List screen
- Implementing the Restaurant Detail screen
- Implementing the Review Form screen
- Implementing the Map screen
- Summary
- Chapter 12: Modifying and Configuring Cells
- Technical requirements
- Modifying the Explore screen section header
- Adding Auto Layout to the Explore screen's section header
- Modifying the exploreCell collection view cell
- Modifying the restaurantCell collection view cell
- Adding Auto Layout constraints to the restaurantCell collection view cell
- Configuring the locationCell table view cell
- Summary
- Part 3: Code
- Chapter 13: Getting Started with MVC and Collection Views
- Technical requirements
- Understanding the Model-View-Controller design pattern
- Exploring controllers and classes
- Understanding collection views
- Revisiting the Explore and Restaurant List screens
- Summary
- Chapter 14: Getting Data into Collection Views
- Technical requirements
- Understanding model objects
- Understanding .plist files
- Creating a structure to represent a cuisine
- Implementing a data manager class to read data from a .plist file
- Using the data manager to initialize ExploreItem instances
- Displaying data in a collection view
- Connecting the outlets in exploreCell
- Implementing additional data manager methods
- Updating the data source methods in ExploreViewController
- Summary
- Chapter 15: Getting Started with Table Views
- Technical requirements
- Understanding table views
- Creating the LocationViewController class
- Connecting the table view to the LocationViewController class
- Adding the data source and delegate methods
- Adding location data for the table view
- Creating the LocationDataManager class
- Displaying data in a table view
- Summary
- Chapter 16: Getting Started with MapKit
- Technical requirements
- Understanding and creating annotations
- Creating the RestaurantItem class
- Creating the MapDataManager class
- Creating the DataManager protocol
- Refactoring the MapDataManager class
- Refactoring the ExploreDataManager class
- Adding annotations to a map view
- Creating the MapViewController class
- Connecting the outlets for the map view
- Setting the map view region to be displayed
- Displaying MKAnnotationView instances on the map view
- Creating custom MKAnnotationView instances
- Going from the Map screen to the Restaurant Detail screen
- Creating and configuring a storyboard reference
- Performing the showDetail segue
- Passing data to the Restaurant Detail screen
- Organizing your code
- Refactoring the ExploreViewController class
- Using the // MARK: syntax
- Refactoring the RestaurantListViewController class
- Refactoring the LocationViewController class
- Refactoring the MapViewController class
- Summary
- Chapter 17: Getting Started with JSON Files
- Technical requirements
- Getting data from JSON files
- Understanding the JSON format
- Creating the RestaurantDataManager class
- Using data from JSON files in your app
- Configuring the MapDataManager instance to use data from the RestaurantDataManager instance
- Storing a user-selected location
- Adding a UICollectionReusableView subclass for the section header in the Explore screen
- Connecting the section header's label to the ExploreViewController class
- Adding an unwind action method to the Done button
- Selecting only one location in the Locations screen
- Passing location and cuisine information to the RestaurantListViewController instance
- Creating a view controller for the cells on the Restaurant List screen
- Connecting the outlets for the RestaurantCell class
- Displaying a custom UIView to indicate no data is available
- Displaying a list of restaurants on the Restaurant List screen
- Summary
- Chapter 18: Displaying Data in a Static Table View
- Technical requirements
- Setting up outlets for the RestaurantDetailViewController class
- Displaying data in the static table view
- Passing data to the RestaurantDetailViewController instance
- Summary
- Chapter 19: Getting Started with Custom UIControls
- Technical requirements
- Creating a custom UIControl subclass
- Displaying stars in your custom UIControl subclass
- Adding support for touch events
- Implementing an unwind method for the Cancel button
- Creating the ReviewFormViewController class
- Summary
- Chapter 20: Getting Started with Cameras and Photo Libraries
- Technical requirements
- Understanding filters
- Creating model objects for the Photo Filter screen
- Creating the ImageFiltering protocol
- Creating classes for the Photo Filter screen
- Creating a class for the collection view cells
- Creating a view controller for the Photo Filter screen
- Getting permission to use the camera or photo library
- Summary
- Chapter 21: Understanding Core Data
- Technical requirements
- Introducing Core Data
- Implementing Core Data components for your app
- Creating a data model
- Creating ReviewItem
- Creating RestaurantPhotoItem
- Creating a Core Data manager
- Understanding how saving and loading works
- Updating the ReviewFormViewController class to save reviews
- Passing RestaurantID to the ReviewFormViewController instance
- Updating the PhotoFilterViewController class to save photos
- Displaying saved reviews and photos on the Restaurant Detail screen
- Calculating a restaurant's overall rating
- Summary
- Part 4: Features
- Chapter 22: Getting Started with Mac Catalyst
- Technical requirements
- Fixing user interface issues
- Making your app run on all iOS devices
- Identifying device type
- Understanding size classes
- Updating the Explore screen
- Updating the Restaurant List screen
- Updating the app to work on macOS
- Summary
- Chapter 23: Getting Started with SwiftUI
- Technical requirements
- Creating a SwiftUI Xcode project
- Creating the Restaurant List screen
- Adding model objects and configuring navigation
- Using UIKit and SwiftUI Views together
- Completing the Restaurant Detail screen
- Summary
- Chapter 24: Getting Started with Swift Concurrency
- Technical requirements
- Understanding Swift Concurrency
- Examining an app without concurrency
- Updating the app using async/await
- Improving efficiency using async-let
- Updating RestaurantListViewController to use async/await
- Summary
- Chapter 25: Getting Started with SharePlay
- Technical requirements
- Understanding SharePlay
- Exploring the ShareOrder app
- Creating a custom Group Activity
- Adding the Group Activities entitlement
- Creating the ShareOrder structure
- Activating a custom group activity
- Managing a group activity session
- Implementing a GroupSession object
- Implementing a GroupSessionMessenger object
- Testing SharePlay in the ShareOrder app
- Summary
- Chapter 26: Testing and Submitting Your App to the App Store
- Technical requirements
- Getting an Apple Developer account
- Exploring your Apple Developer account
- Generating a certificate signing request
- Creating development and distribution certificates
- Registering an App ID
- Registering your devices
- Creating provisioning profiles
- Submitting your app to the App Store
- Creating icons for your app
- Creating screenshots for your app
- Creating an App Store listing
- Creating an archive build
- Completing the information in App Store Connect
- Testing your app
- Testing your app internally
- Testing your app externally
- Summary
- Why subscribe?
- Other Books You May Enjoy
- Packt is searching for authors like you
- Tytuły: iOS 15 Programming for Beginners - Sixth Edition
- Autor: Ahmad Sahar, Craig Clayton
- Tytuł oryginału: iOS 15 Programming for Beginners - Sixth Edition
- ISBN Ebooka: 9781801812139, 9781801812139
- Data wydania: 2021-12-24
- Identyfikator pozycji: e_2t37
- Kategorie:
- Wydawca: Packt Publishing