Linked e-resources
Details
Table of Contents
Intro
1. Start Here
1.1 For Swift Programmers
1.2 For Non-Swift Programmers
1.3 Source Code Download
1.4 Feedback
1.5 Errata
2. Joining the Apple Developer Program
2.1 Downloading Xcode 15 and the iOS 17 SDK
2.2 Apple Developer Program
2.3 When to Enroll in the Apple Developer Program?
2.4 Enrolling in the Apple Developer Program
2.5 Summary
3. Installing Xcode 15 and the iOS 17 SDK
3.1 Identifying Your macOS Version
3.2 Installing Xcode 15 and the iOS 17 SDK
3.3 Starting Xcode
3.4 Adding Your Apple ID to the Xcode Preferences
3.5 Developer and Distribution Signing Identities
3.6 Summary
4. An Introduction to Xcode 15 Playgrounds
4.1 What is a Playground?
4.2 Creating a New Playground
4.3 A Swift Playground Example
4.4 Viewing Results
4.5 Adding Rich Text Comments
4.6 Working with Playground Pages
4.7 Working with SwiftUI and Live View in Playgrounds
4.8 Summary
5. Swift Data Types, Constants, and Variables
5.1 Using a Swift Playground
5.2 Swift Data Types
5.2.1 Integer Data Types
5.2.2 Floating Point Data Types
5.2.3 Bool Data Type
5.2.4 Character Data Type
5.2.5 String Data Type
5.2.6 Special Characters/Escape Sequences
5.3 Swift Variables
5.4 Swift Constants
5.5 Declaring Constants and Variables
5.6 Type Annotations and Type Inference
5.7 The Swift Tuple
5.8 The Swift Optional Type
5.9 Type Casting and Type Checking
5.10 Summary
6. Swift Operators and Expressions
6.1 Expression Syntax in Swift
6.2 The Basic Assignment Operator
6.3 Swift Arithmetic Operators
6.4 Compound Assignment Operators
6.5 Comparison Operators
6.6 Boolean Logical Operators
6.7 Range Operators
6.8 The Ternary Operator
6.9 Nil Coalescing Operator
6.10 Bitwise Operators
6.10.1 Bitwise NOT.
6.10.2 Bitwise AND
6.10.3 Bitwise OR
6.10.4 Bitwise XOR
6.10.5 Bitwise Left Shift
6.10.6 Bitwise Right Shift
6.11 Compound Bitwise Operators
6.12 Summary
7. Swift Control Flow
7.1 Looping Control Flow
7.2 The Swift for-in Statement
7.2.1 The while Loop
7.3 The repeat ... while loop
7.4 Breaking from Loops
7.5 The continue Statement
7.6 Conditional Control Flow
7.7 Using the if Statement
7.8 Using if ... else … Statements
7.9 Using if ... else if ... Statements
7.10 The guard Statement
7.11 Summary
8. The Swift Switch Statement
8.1 Why Use a switch Statement?
8.2 Using the switch Statement Syntax
8.3 A Swift switch Statement Example
8.4 Combining case Statements
8.5 Range Matching in a switch Statement
8.6 Using the where statement
8.7 Fallthrough
8.8 Summary
9. Swift Functions, Methods, and Closures
9.1 What is a Function?
9.2 What is a Method?
9.3 How to Declare a Swift Function
9.4 Implicit Returns from Single Expressions
9.5 Calling a Swift Function
9.6 Handling Return Values
9.7 Local and External Parameter Names
9.8 Declaring Default Function Parameters
9.9 Returning Multiple Results from a Function
9.10 Variable Numbers of Function Parameters
9.11 Parameters as Variables
9.12 Working with In-Out Parameters
9.13 Functions as Parameters
9.14 Closure Expressions
9.15 Shorthand Argument Names
9.16 Closures in Swift
9.17 Summary
10. The Basics of Swift Object-Oriented Programming
10.1 What is an Instance?
10.2 What is a Class?
10.3 Declaring a Swift Class
10.4 Adding Instance Properties to a Class
10.5 Defining Methods
10.6 Declaring and Initializing a Class Instance
10.7 Initializing and De-initializing a Class Instance
10.8 Calling Methods and Accessing Properties.
10.9 Stored and Computed Properties
10.10 Lazy Stored Properties
10.11 Using self in Swift
10.12 Understanding Swift Protocols
10.13 Opaque Return Types
10.14 Summary
11. An Introduction to Swift Subclassing and Extensions
11.1 Inheritance, Classes, and Subclasses
11.2 A Swift Inheritance Example
11.3 Extending the Functionality of a Subclass
11.4 Overriding Inherited Methods
11.5 Initializing the Subclass
11.6 Using the SavingsAccount Class
11.7 Swift Class Extensions
11.8 Summary
12. An Introduction to Swift Structures and Enumerations
12.1 An Overview of Swift Structures
12.2 Value Types vs. Reference Types
12.3 When to Use Structures or Classes
12.4 An Overview of Enumerations
12.5 Summary
13. An Introduction to Swift Property Wrappers
13.1 Understanding Property Wrappers
13.2 A Simple Property Wrapper Example
13.3 Supporting Multiple Variables and Types
13.4 Summary
14. Working with Array and Dictionary Collections in Swift
14.1 Mutable and Immutable Collections
14.2 Swift Array Initialization
14.3 Working with Arrays in Swift
14.3.1 Array Item Count
14.3.2 Accessing Array Items
14.3.3 Random Items and Shuffling
14.3.4 Appending Items to an Array
14.3.5 Inserting and Deleting Array Items
14.3.6 Array Iteration
14.4 Creating Mixed Type Arrays
14.5 Swift Dictionary Collections
14.6 Swift Dictionary Initialization
14.7 Sequence-based Dictionary Initialization
14.8 Dictionary Item Count
14.9 Accessing and Updating Dictionary Items
14.10 Adding and Removing Dictionary Entries
14.11 Dictionary Iteration
14.12 Summary
15. Understanding Error Handling in Swift 5
15.1 Understanding Error Handling
15.2 Declaring Error Types
15.3 Throwing an Error
15.4 Calling Throwing Methods and Functions.
15.5 Accessing the Error Object
15.6 Disabling Error Catching
15.7 Using the defer Statement
15.8 Summary
16. An Overview of SwiftUI
16.1 UIKit and Interface Builder
16.2 SwiftUI Declarative Syntax
16.3 SwiftUI is Data Driven
16.4 SwiftUI vs. UIKit
16.5 Summary
17. Using Xcode in SwiftUI Mode
17.1 Starting Xcode 15
17.2 Creating a SwiftUI Project
17.3 Xcode in SwiftUI Mode
17.4 The Preview Canvas
17.5 Preview Pinning
17.6 The Preview Toolbar
17.7 Modifying the Design
17.8 Editor Context Menu
17.9 Running the App on a Simulator
17.10 Running the App on a Physical iOS Device
17.11 Managing Devices and Simulators
17.12 Enabling Network Testing
17.13 Dealing with Build Errors
17.14 Monitoring Application Performance
17.15 Exploring the User Interface Layout Hierarchy
17.16 Summary
18. SwiftUI Architecture
18.1 SwiftUI App Hierarchy
18.2 App
18.3 Scenes
18.4 Views
18.5 Summary
19. The Anatomy of a Basic SwiftUI Project
19.1 Creating an Example Project
19.2 The DemoProjectApp.swift File
19.3 The ContentView.swift File
19.4 Assets.xcassets
19.5 DemoProject.entitlements
19.6 Preview Content
19.7 Summary
20. Creating Custom Views with SwiftUI
20.1 SwiftUI Views
20.2 Creating a Basic View
20.3 Adding Views
20.4 SwiftUI Hierarchies
20.5 Concatenating Text Views
20.6 Working with Subviews
20.7 Views as Properties
20.8 Modifying Views
20.9 Working with Text Styles
20.10 Modifier Ordering
20.11 Custom Modifiers
20.12 Basic Event Handling
20.13 Building Custom Container Views
20.14 Working with the Label View
20.15 Summary
21. SwiftUI Stacks and Frames
21.1 SwiftUI Stacks
21.2 Spacers, Alignment and Padding
21.3 Grouping Views
21.4 Dynamic HStack and VStack Conversion.
21.5 Text Line Limits and Layout Priority
21.6 Traditional vs. Lazy Stacks
21.7 SwiftUI Frames
21.8 Frames and the Geometry Reader
21.9 Summary
22. SwiftUI State Properties, Observation, and Environment Objects
22.1 State Properties
22.2 State Binding
22.3 Observable Objects
22.4 Observation using Combine
22.5 Combine State Objects
22.6 Using the Observation Framework
22.7 Observation and @Bindable
22.8 Environment Objects
22.9 Summary
23. A SwiftUI Example Tutorial
23.1 Creating the Example Project
23.2 Reviewing the Project
23.3 Modifying the Layout
23.4 Adding a Slider View to the Stack
23.5 Adding a State Property
23.6 Adding Modifiers to the Text View
23.7 Adding Rotation and Animation
23.8 Adding a TextField to the Stack
23.9 Adding a Color Picker
23.10 Tidying the Layout
23.11 Summary
24. An Overview of Swift Structured Concurrency
24.1 An Overview of Threads
24.2 The Application Main Thread
24.3 Completion Handlers
24.4 Structured Concurrency
24.5 Preparing the Project
24.6 Non-Concurrent Code
24.7 Introducing async/await Concurrency
24.8 Asynchronous Calls from Synchronous Functions
24.9 The await Keyword
24.10 Using async-let Bindings
24.11 Handling Errors
24.12 Understanding Tasks
24.13 Unstructured Concurrency
24.14 Detached Tasks
24.15 Task Management
24.16 Working with Task Groups
24.17 Avoiding Data Races
24.18 The for-await Loop
24.19 Asynchronous Properties
24.20 Summary
25. An Introduction to Swift Actors
25.1 An Overview of Actors
25.2 Declaring an Actor
25.3 Understanding Data Isolation
25.4 A Swift Actor Example
25.5 Introducing the MainActor
25.6 Summary
26. SwiftUI Concurrency and Lifecycle Event Modifiers
26.1 Creating the LifecycleDemo Project.
26.2 Designing the App.
1. Start Here
1.1 For Swift Programmers
1.2 For Non-Swift Programmers
1.3 Source Code Download
1.4 Feedback
1.5 Errata
2. Joining the Apple Developer Program
2.1 Downloading Xcode 15 and the iOS 17 SDK
2.2 Apple Developer Program
2.3 When to Enroll in the Apple Developer Program?
2.4 Enrolling in the Apple Developer Program
2.5 Summary
3. Installing Xcode 15 and the iOS 17 SDK
3.1 Identifying Your macOS Version
3.2 Installing Xcode 15 and the iOS 17 SDK
3.3 Starting Xcode
3.4 Adding Your Apple ID to the Xcode Preferences
3.5 Developer and Distribution Signing Identities
3.6 Summary
4. An Introduction to Xcode 15 Playgrounds
4.1 What is a Playground?
4.2 Creating a New Playground
4.3 A Swift Playground Example
4.4 Viewing Results
4.5 Adding Rich Text Comments
4.6 Working with Playground Pages
4.7 Working with SwiftUI and Live View in Playgrounds
4.8 Summary
5. Swift Data Types, Constants, and Variables
5.1 Using a Swift Playground
5.2 Swift Data Types
5.2.1 Integer Data Types
5.2.2 Floating Point Data Types
5.2.3 Bool Data Type
5.2.4 Character Data Type
5.2.5 String Data Type
5.2.6 Special Characters/Escape Sequences
5.3 Swift Variables
5.4 Swift Constants
5.5 Declaring Constants and Variables
5.6 Type Annotations and Type Inference
5.7 The Swift Tuple
5.8 The Swift Optional Type
5.9 Type Casting and Type Checking
5.10 Summary
6. Swift Operators and Expressions
6.1 Expression Syntax in Swift
6.2 The Basic Assignment Operator
6.3 Swift Arithmetic Operators
6.4 Compound Assignment Operators
6.5 Comparison Operators
6.6 Boolean Logical Operators
6.7 Range Operators
6.8 The Ternary Operator
6.9 Nil Coalescing Operator
6.10 Bitwise Operators
6.10.1 Bitwise NOT.
6.10.2 Bitwise AND
6.10.3 Bitwise OR
6.10.4 Bitwise XOR
6.10.5 Bitwise Left Shift
6.10.6 Bitwise Right Shift
6.11 Compound Bitwise Operators
6.12 Summary
7. Swift Control Flow
7.1 Looping Control Flow
7.2 The Swift for-in Statement
7.2.1 The while Loop
7.3 The repeat ... while loop
7.4 Breaking from Loops
7.5 The continue Statement
7.6 Conditional Control Flow
7.7 Using the if Statement
7.8 Using if ... else … Statements
7.9 Using if ... else if ... Statements
7.10 The guard Statement
7.11 Summary
8. The Swift Switch Statement
8.1 Why Use a switch Statement?
8.2 Using the switch Statement Syntax
8.3 A Swift switch Statement Example
8.4 Combining case Statements
8.5 Range Matching in a switch Statement
8.6 Using the where statement
8.7 Fallthrough
8.8 Summary
9. Swift Functions, Methods, and Closures
9.1 What is a Function?
9.2 What is a Method?
9.3 How to Declare a Swift Function
9.4 Implicit Returns from Single Expressions
9.5 Calling a Swift Function
9.6 Handling Return Values
9.7 Local and External Parameter Names
9.8 Declaring Default Function Parameters
9.9 Returning Multiple Results from a Function
9.10 Variable Numbers of Function Parameters
9.11 Parameters as Variables
9.12 Working with In-Out Parameters
9.13 Functions as Parameters
9.14 Closure Expressions
9.15 Shorthand Argument Names
9.16 Closures in Swift
9.17 Summary
10. The Basics of Swift Object-Oriented Programming
10.1 What is an Instance?
10.2 What is a Class?
10.3 Declaring a Swift Class
10.4 Adding Instance Properties to a Class
10.5 Defining Methods
10.6 Declaring and Initializing a Class Instance
10.7 Initializing and De-initializing a Class Instance
10.8 Calling Methods and Accessing Properties.
10.9 Stored and Computed Properties
10.10 Lazy Stored Properties
10.11 Using self in Swift
10.12 Understanding Swift Protocols
10.13 Opaque Return Types
10.14 Summary
11. An Introduction to Swift Subclassing and Extensions
11.1 Inheritance, Classes, and Subclasses
11.2 A Swift Inheritance Example
11.3 Extending the Functionality of a Subclass
11.4 Overriding Inherited Methods
11.5 Initializing the Subclass
11.6 Using the SavingsAccount Class
11.7 Swift Class Extensions
11.8 Summary
12. An Introduction to Swift Structures and Enumerations
12.1 An Overview of Swift Structures
12.2 Value Types vs. Reference Types
12.3 When to Use Structures or Classes
12.4 An Overview of Enumerations
12.5 Summary
13. An Introduction to Swift Property Wrappers
13.1 Understanding Property Wrappers
13.2 A Simple Property Wrapper Example
13.3 Supporting Multiple Variables and Types
13.4 Summary
14. Working with Array and Dictionary Collections in Swift
14.1 Mutable and Immutable Collections
14.2 Swift Array Initialization
14.3 Working with Arrays in Swift
14.3.1 Array Item Count
14.3.2 Accessing Array Items
14.3.3 Random Items and Shuffling
14.3.4 Appending Items to an Array
14.3.5 Inserting and Deleting Array Items
14.3.6 Array Iteration
14.4 Creating Mixed Type Arrays
14.5 Swift Dictionary Collections
14.6 Swift Dictionary Initialization
14.7 Sequence-based Dictionary Initialization
14.8 Dictionary Item Count
14.9 Accessing and Updating Dictionary Items
14.10 Adding and Removing Dictionary Entries
14.11 Dictionary Iteration
14.12 Summary
15. Understanding Error Handling in Swift 5
15.1 Understanding Error Handling
15.2 Declaring Error Types
15.3 Throwing an Error
15.4 Calling Throwing Methods and Functions.
15.5 Accessing the Error Object
15.6 Disabling Error Catching
15.7 Using the defer Statement
15.8 Summary
16. An Overview of SwiftUI
16.1 UIKit and Interface Builder
16.2 SwiftUI Declarative Syntax
16.3 SwiftUI is Data Driven
16.4 SwiftUI vs. UIKit
16.5 Summary
17. Using Xcode in SwiftUI Mode
17.1 Starting Xcode 15
17.2 Creating a SwiftUI Project
17.3 Xcode in SwiftUI Mode
17.4 The Preview Canvas
17.5 Preview Pinning
17.6 The Preview Toolbar
17.7 Modifying the Design
17.8 Editor Context Menu
17.9 Running the App on a Simulator
17.10 Running the App on a Physical iOS Device
17.11 Managing Devices and Simulators
17.12 Enabling Network Testing
17.13 Dealing with Build Errors
17.14 Monitoring Application Performance
17.15 Exploring the User Interface Layout Hierarchy
17.16 Summary
18. SwiftUI Architecture
18.1 SwiftUI App Hierarchy
18.2 App
18.3 Scenes
18.4 Views
18.5 Summary
19. The Anatomy of a Basic SwiftUI Project
19.1 Creating an Example Project
19.2 The DemoProjectApp.swift File
19.3 The ContentView.swift File
19.4 Assets.xcassets
19.5 DemoProject.entitlements
19.6 Preview Content
19.7 Summary
20. Creating Custom Views with SwiftUI
20.1 SwiftUI Views
20.2 Creating a Basic View
20.3 Adding Views
20.4 SwiftUI Hierarchies
20.5 Concatenating Text Views
20.6 Working with Subviews
20.7 Views as Properties
20.8 Modifying Views
20.9 Working with Text Styles
20.10 Modifier Ordering
20.11 Custom Modifiers
20.12 Basic Event Handling
20.13 Building Custom Container Views
20.14 Working with the Label View
20.15 Summary
21. SwiftUI Stacks and Frames
21.1 SwiftUI Stacks
21.2 Spacers, Alignment and Padding
21.3 Grouping Views
21.4 Dynamic HStack and VStack Conversion.
21.5 Text Line Limits and Layout Priority
21.6 Traditional vs. Lazy Stacks
21.7 SwiftUI Frames
21.8 Frames and the Geometry Reader
21.9 Summary
22. SwiftUI State Properties, Observation, and Environment Objects
22.1 State Properties
22.2 State Binding
22.3 Observable Objects
22.4 Observation using Combine
22.5 Combine State Objects
22.6 Using the Observation Framework
22.7 Observation and @Bindable
22.8 Environment Objects
22.9 Summary
23. A SwiftUI Example Tutorial
23.1 Creating the Example Project
23.2 Reviewing the Project
23.3 Modifying the Layout
23.4 Adding a Slider View to the Stack
23.5 Adding a State Property
23.6 Adding Modifiers to the Text View
23.7 Adding Rotation and Animation
23.8 Adding a TextField to the Stack
23.9 Adding a Color Picker
23.10 Tidying the Layout
23.11 Summary
24. An Overview of Swift Structured Concurrency
24.1 An Overview of Threads
24.2 The Application Main Thread
24.3 Completion Handlers
24.4 Structured Concurrency
24.5 Preparing the Project
24.6 Non-Concurrent Code
24.7 Introducing async/await Concurrency
24.8 Asynchronous Calls from Synchronous Functions
24.9 The await Keyword
24.10 Using async-let Bindings
24.11 Handling Errors
24.12 Understanding Tasks
24.13 Unstructured Concurrency
24.14 Detached Tasks
24.15 Task Management
24.16 Working with Task Groups
24.17 Avoiding Data Races
24.18 The for-await Loop
24.19 Asynchronous Properties
24.20 Summary
25. An Introduction to Swift Actors
25.1 An Overview of Actors
25.2 Declaring an Actor
25.3 Understanding Data Isolation
25.4 A Swift Actor Example
25.5 Introducing the MainActor
25.6 Summary
26. SwiftUI Concurrency and Lifecycle Event Modifiers
26.1 Creating the LifecycleDemo Project.
26.2 Designing the App.