iOS 26 App Development Essentials - SwiftUI Edition - Neil Smyth - E-Book

iOS 26 App Development Essentials - SwiftUI Edition E-Book

Neil Smyth

0,0
33,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

This book teaches the skills needed to build iOS applications using SwiftUI, Xcode, and the Swift programming language.


Beginning with the basics, this book outlines the steps to set up an iOS development environment and introduces using Swift Playgrounds for learning and experimenting with the Swift programming language.


The book also includes in-depth chapters that introduce the Swift programming language, covering data types, control flow, functions, object-oriented programming, property wrappers, structured concurrency, and error handling.


This guide begins with an introduction to key concepts of SwiftUI and project architecture, followed by a detailed tour of Xcode and AI-assisted development using Coding Intelligence. The book also covers how to create custom SwiftUI views, combine them to build user interface layouts, including stacks, frames, and forms.


Other topics covered include data handling using state properties and observable, state, and environment objects, as well as key user interface design concepts such as modifiers, lists, tabbed views, context menus, user interface navigation, and outline groups.


The book also includes chapters covering graphics and Liquid Glass effects, user interface animation, view transitions, and gesture handling, as well as WidgetKit, Live Activities, document-based apps, Core Data, SwiftData, and CloudKit.


Throughout the book, each concept is reinforced with hands-on tutorials and downloadable source code. Additionally, over 50 online quizzes are available to test your knowledge and understanding.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 666

Veröffentlichungsjahr: 2025

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



iOS 26 App Development

Essentials

SwiftUI Edition

iOS 26 App Development Essentials - SwiftUI Edition

ISBN-13: 978-1-965764-26-8

© 2025 Neil Smyth / Payload Media, Inc. All Rights Reserved.

This book is provided for personal use only. Unauthorized use, reproduction and/or distribution strictly prohibited. All rights reserved.

The content of this book is provided for informational purposes only. Neither the publisher nor the author offers any warranties or representation, express or implied, with regard to the accuracy of information contained in this book, nor do they accept any liability for any loss or damage arising from any errors or omissions.

This book contains trademarked terms that are used solely for editorial purposes and to the benefit of the respective trademark owner. The terms used within this book are not intended as infringement of any trademarks.

Rev: 1.0

https://www.payloadbooks.com

Table of Contents

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

1.6 Take the Knowledge Tests

2. Joining the Apple Developer Program

2.1 Downloading Xcode 26 and the iOS 26 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 26 and the iOS 26 SDK

3.1 Identifying Your macOS Version

3.2 Installing Xcode 26 and the iOS 26 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 26 Playgrounds

4.1 What is a Playground?

4.2 Creating a New Playground

4.3 A Swift Playground Example

4.4 Value History

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 Take the Knowledge Test

5.11 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 Take the Knowledge Test

6.13 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 Take the Knowledge Test

7.12 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 Take the Knowledge Test

8.9 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 Take the Knowledge Test

9.18 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 Take the Knowledge Test

10.15 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 Take the Knowledge Test

11.9 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 Take the Knowledge Test

12.6 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 Take the Knowledge Test

13.5 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 Take the Knowledge Test

14.13 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 Take the Knowledge Test

15.9 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 Take the Knowledge Test

16.6 Summary

17. Using Xcode in SwiftUI Mode

17.1 Starting Xcode 26

17.2 Creating a SwiftUI Project

17.3 Xcode in SwiftUI Mode

17.4 Tab Bar Navigation

17.5 Minimap

17.6 The Preview Canvas

17.7 Preview Pinning

17.8 The Preview Toolbar

17.9 Modifying the Design

17.10 Editor Context Menu

17.11 Running the App on a Simulator

17.12 Running the App on a Physical iOS Device

17.13 Managing Devices and Simulators

17.14 Dealing with Build Errors

17.15 Monitoring Application Performance

17.16 Exploring the User Interface Layout Hierarchy

17.17 Take the Knowledge Test

17.18 Summary

18. Coding Intelligence in Xcode

18.1 About Coding Intelligence

18.2 Enabling Coding Intelligence

18.3 Using the Coding Assistant

18.4 Providing Context in Prompts

18.5 Using Coding Intelligence

18.6 Creating a Git Repository

18.7 Using the Modification History

18.8 Conversations and Modification Histories

18.9 Committing Changes

18.10 Working with Code Completion

18.11 Take the Knowledge Test

18.12 Summary

19. SwiftUI Architecture

19.1 SwiftUI App Hierarchy

19.2 App

19.3 Scenes

19.4 Views

19.5 Take the Knowledge Test

19.6 Summary

20. The Anatomy of a Basic SwiftUI Project

20.1 Creating an Example Project

20.2 The DemoProjectApp.swift File

20.3 The ContentView.swift File

20.4 Assets.xcassets

20.5 DemoProject.entitlements

20.6 Preview Content

20.7 Take the Knowledge Test

20.8 Summary

21. Creating Custom Views with SwiftUI

21.1 SwiftUI Views

21.2 Creating a Basic View

21.3 Adding Views

21.4 SwiftUI Hierarchies

21.5 Working with Subviews

21.6 Views as Properties

21.7 Modifying Views

21.8 Working with Text Styles

21.9 Modifier Ordering

21.10 Custom Modifiers

21.11 Basic Event Handling

21.12 Building Custom Container Views

21.13 Working with the Label View

21.14 Take the Knowledge Test

21.15 Summary

22. SwiftUI Stacks and Frames

22.1 SwiftUI Stacks

22.2 Spacers, Alignment and Padding

22.3 Grouping Views

22.4 Dynamic HStack and VStack Conversion

22.5 Text Line Limits and Layout Priority

22.6 Traditional vs. Lazy Stacks

22.7 SwiftUI Frames

22.8 Frames and the Geometry Reader

22.9 Take the Knowledge Test

22.10 Summary

23. SwiftUI State Properties, Observation, and Environment Objects

23.1 State Properties

23.2 State Binding

23.3 Observable Objects

23.4 Observation using Combine

23.5 Combine State Objects

23.6 Using the Observation Framework

23.7 Observation and @Bindable

23.8 Environment Objects

23.9 Take the Knowledge Test

23.10 Summary

24. A SwiftUI Example Tutorial

24.1 Creating the Example Project

24.2 Reviewing the Project

24.3 Modifying the Layout

24.4 Adding a Slider View to the Stack

24.5 Adding a State Property

24.6 Adding Modifiers to the Text View

24.7 Adding Rotation and Animation

24.8 Adding a TextField to the Stack

24.9 Adding a Color Picker

24.10 Tidying the Layout

24.11 Take the Knowledge Test

24.12 Summary

25. SwiftUI Stack Alignment and Alignment Guides

25.1 Container Alignment

25.2 Alignment Guides

25.3 Custom Alignment Types

25.4 Cross Stack Alignment

25.5 ZStack Custom Alignment

25.6 Take the Knowledge Test

25.7 Summary

26. An Overview of Swift Structured Concurrency

26.1 An Overview of Threads

26.2 The Application Main Thread

26.3 Completion Handlers

26.4 Structured Concurrency

26.5 Preparing the Project

26.6 Non-Concurrent Code

26.7 Introducing async/await Concurrency

26.8 Asynchronous Calls from Synchronous Functions

26.9 The await Keyword

26.10 Using async-let Bindings

26.11 Handling Errors

26.12 Understanding Tasks

26.13 Unstructured Concurrency

26.14 Detached Tasks

26.15 Task Management

26.16 Working with Task Groups

26.17 Avoiding Data Races

26.18 The for-await Loop

26.19 Asynchronous Properties

26.20 Take the Knowledge Test

26.21 Summary

27. An Introduction to Swift Actors

27.1 An Overview of Actors

27.2 Declaring an Actor

27.3 Understanding Data Isolation

27.4 A Swift Actor Example

27.5 Introducing the MainActor

27.6 Changing Isolation Defaults

27.7 Take the Knowledge Test

27.8 Summary

28. SwiftUI Concurrency and Lifecycle Event Modifiers

28.1 Creating the LifecycleDemo Project

28.2 Designing the App

28.3 The onAppear and onDisappear Modifiers

28.4 The onChange Modifier

28.5 ScenePhase and the onChange Modifier

28.6 Launching Concurrent Tasks

28.7 Take the Knowledge Test

28.8 Summary

29. SwiftUI Observable and Environment Objects – A Tutorial

29.1 About the ObservableDemo Project

29.2 Creating the Project

29.3 Adding the Observable Object

29.4 Designing the ContentView Layout

29.5 Adding the Second View

29.6 Adding Navigation

29.7 Using an Environment Object

29.8 Take the Knowledge Test

29.9 Summary

30. SwiftUI Data Persistence using AppStorage and SceneStorage

30.1 The @SceneStorage Property Wrapper

30.2 The @AppStorage Property Wrapper

30.3 Creating and Preparing the StorageDemo Project

30.4 Using Scene Storage

30.5 Using App Storage

30.6 Storing Custom Types

30.7 Take the Knowledge Test

30.8 Summary

31. SwiftUI Lists and Navigation

31.1 SwiftUI Lists

31.2 Modifying List Separators and Rows

31.3 SwiftUI Dynamic Lists

31.4 Adding a Section Index

31.5 Creating a Refreshable List

31.6 SwiftUI NavigationStack and NavigationLink

31.7 Navigation by Value Type

31.8 Working with Navigation Paths

31.9 Navigation Bar Customization

31.10 Making the List Editable

31.11 Hierarchical Lists

31.12 Multicolumn Navigation

31.13 Take the Knowledge Test

31.14 Summary

32. A SwiftUI List and NavigationStack Tutorial

32.1 About the ListNavDemo Project

32.2 Creating the ListNavDemo Project

32.3 Preparing the Project

32.4 Adding the Car Structure

32.5 Adding the Data Store

32.6 Designing the Content View

32.7 Designing the Detail View

32.8 Adding Navigation to the List

32.9 Designing the Add Car View

32.10 Implementing Add and Edit Buttons

32.11 Adding a Navigation Path

32.12 Adding the Edit Button Methods

32.13 Summary

33. An Overview of Split View Navigation

33.1 Introducing NavigationSplitView

33.2 Using NavigationSplitView

33.3 Handling List Selection

33.4 NavigationSplitView Configuration

33.5 Controlling Column Visibility

33.6 Take the Knowledge Test

33.7 Summary

34. A NavigationSplitView Tutorial

34.1 About the Project

34.2 Creating the NavSplitDemo Project

34.3 Adding the Project Data

34.4 Creating the Navigation View

34.5 Building the Sidebar Column

34.6 Adding the Content Column List

34.7 Adding the Detail Column

34.8 Summary

35. An Overview of List, OutlineGroup and DisclosureGroup

35.1 Hierarchical Data and Disclosures

35.2 Hierarchies and Disclosure in SwiftUI Lists

35.3 Using OutlineGroup

35.4 Using DisclosureGroup

35.5 Take the Knowledge Test

35.6 Summary

36. A SwiftUI List, OutlineGroup, and DisclosureGroup Tutorial

36.1 About the Example Project

36.2 Creating the OutlineGroupDemo Project

36.3 Adding the Data Structure

36.4 Adding the List View

36.5 Testing the Project

36.6 Using OutlineGroup

36.7 Working with DisclosureGroups

36.8 Summary

37. Building SwiftUI Grids with LazyVGrid and LazyHGrid

37.1 SwiftUI Grids

37.2 GridItems

37.3 Creating the GridDemo Project

37.4 Working with Flexible GridItems

37.5 Adding Scrolling Support to a Grid

37.6 Working with Adaptive GridItems

37.7 Working with Fixed GridItems

37.8 Using the LazyHGrid View

37.9 Take the Knowledge Test

37.10 Summary

38. Building SwiftUI Grids with Grid and GridRow

38.1 Grid and GridRow Views

38.2 Creating the GridRowDemo Project

38.3 A Simple Grid Layout

38.4 Non-GridRow Children

38.5 Automatic Empty Grid Cells

38.6 Adding Empty Cells

38.7 Column Spanning

38.8 Grid Alignment and Spacing

38.9 Take the Knowledge Test

38.10 Summary

39. Building Custom Containers

39.1 Introducing custom containers

39.2 Working with ViewBuilder Closures

39.3 Supporting Section Headers

39.4 Take the Knowledge Test

39.5 Summary

40. A SwiftUI Custom Container Tutorial

40.1 About the Custom Container Project

40.2 Creating the CustomContainerDemo Project

40.3 Adding the Sample Data

40.4 Declaring the Item View

40.5 Designing the Container

40.6 Using the Custom Container

40.7 Completing the Item View

40.8 Adding Section Headers

40.9 Summary

41. Building Tabbed and Paged Views in SwiftUI

41.1 An Overview of SwiftUI TabView

41.2 Creating the TabViewDemo App

41.3 Adding the TabView Container

41.4 Adding the Content Views

41.5 Adding View Paging

41.6 Adding the Tab Items

41.7 Adding Tab Item Tags

41.8 Adding Minimizing Behavior

41.9 Take the Knowledge Test

41.10 Summary

42. Building Context Menus in SwiftUI

42.1 Creating the ContextMenuDemo Project

42.2 Preparing the Content View

42.3 Adding the Context Menu

42.4 Testing the Context Menu

42.5 Take the Knowledge Test

42.6 Summary

43. Basic SwiftUI Graphics Drawing

43.1 Creating the DrawDemo Project

43.2 SwiftUI Shapes

43.3 Using Overlays

43.4 Drawing Custom Paths and Shapes

43.5 Color Mixing

43.6 Color Gradients and Shadows

43.7 Drawing Gradients

43.8 Mesh Gradients

43.9 Take the Knowledge Test

43.10 Summary

44. SwiftUI Animation and Transitions

44.1 Creating the AnimationDemo Example Project

44.2 Implicit Animation

44.3 Repeating an Animation

44.4 Explicit Animation

44.5 Animation and State Bindings

44.6 Automatically Starting an Animation

44.7 SwiftUI Transitions

44.8 Combining Transitions

44.9 Asymmetrical Transitions

44.10 Take the Knowledge Test

44.11 Summary

45. Working with Gesture Recognizers in SwiftUI

45.1 Creating the GestureDemo Example Project

45.2 Basic Gestures

45.3 The onChange Action Callback

45.4 The updating Callback Action

45.5 Composing Gestures

45.6 Take the Knowledge Test

45.7 Summary

46. Working with Liquid Glass

46.1 An Overview of Liquid Glass

46.2 Creating the GlassDemo Project

46.3 The Liquid Glass Modifier

46.4 Liquid Glass Examples

46.5 Using the GlassEffectContainer

46.6 Working with Glass Effect Unions

46.7 Animating Transitions

46.8 Take the Knowledge Test

46.9 Summary

47. Creating a Customized SwiftUI ProgressView

47.1 ProgressView Styles

47.2 Creating the ProgressViewDemo Project

47.3 Adding a ProgressView

47.4 Using the Circular ProgressView Style

47.5 Declaring an Indeterminate ProgressView

47.6 ProgressView Customization

47.7 Take the Knowledge Test

47.8 Summary

48. An Overview of SwiftUI DocumentGroup Scenes

48.1 Documents in Apps

48.2 Creating the DocDemo App

48.3 The DocumentGroup Scene

48.4 Declaring File Type Support

48.4.1 Document Content Type Identifier

48.4.2 Handler Rank

48.4.3 Type Identifiers

48.4.4 Filename Extensions

48.4.5 Custom Type Document Content Identifiers

48.4.6 Exported vs. Imported Type Identifiers

48.5 Configuring File Type Support in Xcode

48.6 The Document Structure

48.7 The Content View

48.8 Adding Navigation

48.9 Running the Example App

48.10 Customizing the Launch Screen

48.11 Take the Knowledge Test

48.12 Summary

49. A SwiftUI DocumentGroup Tutorial

49.1 Creating the ImageDocDemo Project

49.2 Modifying the Info.plist File

49.3 Adding an Image Asset

49.4 Modifying the ImageDocDemoDocument.swift File

49.5 Designing the Content View

49.6 Filtering the Image

49.7 Testing the App

49.8 Summary

50. An Introduction to Core Data and SwiftUI

50.1 The Core Data Stack

50.2 Persistent Container

50.3 Managed Objects

50.4 Managed Object Context

50.5 Managed Object Model

50.6 Persistent Store Coordinator

50.7 Persistent Object Store

50.8 Defining an Entity Description

50.9 Initializing the Persistent Container

50.10 Obtaining the Managed Object Context

50.11 Setting the Attributes of a Managed Object

50.12 Saving a Managed Object

50.13 Fetching Managed Objects

50.14 Retrieving Managed Objects based on Criteria

50.15 Take the Knowledge Test

50.16 Summary

51. A SwiftUI Core Data Tutorial

51.1 Creating the CoreDataDemo Project

51.2 Defining the Entity Description

51.3 Creating the Persistence Controller

51.4 Setting up the View Context

51.5 Preparing the ContentView for Core Data

51.6 Designing the User Interface

51.7 Saving Products

51.8 Testing the addProduct() Function

51.9 Deleting Products

51.10 Adding the Search Function

51.11 Testing the Completed App

51.12 Summary

52. An Overview of SwiftUI Core Data and CloudKit Storage

52.1 An Overview of CloudKit

52.2 CloudKit Containers

52.3 CloudKit Public Database

52.4 CloudKit Private Databases

52.5 Data Storage Quotas

52.6 CloudKit Records

52.7 CloudKit Record IDs

52.8 CloudKit References

52.9 Record Zones

52.10 CloudKit Console

52.11 CloudKit Sharing

52.12 CloudKit Subscriptions

52.13 Take the Knowledge Test

52.14 Summary

53. A SwiftUI Core Data and CloudKit Tutorial

53.1 Enabling CloudKit Support

53.2 Enabling Background Notifications Support

53.3 Switching to the CloudKit Persistent Container

53.4 Testing the App

53.5 Reviewing the Saved Data in the CloudKit Console

53.6 Filtering and Sorting Queries

53.7 Editing and Deleting Records

53.8 Adding New Records

53.9 Summary

54. An Introduction to SwiftData

54.1 Introducing SwiftData

54.2 Model Classes

54.3 Model Container

54.4 Model Configuration

54.5 Model Context

54.6 Predicates and FetchDescriptors

54.7 The @Query Macro

54.8 Model Relationships

54.9 Model Attributes

54.10 Take the Knowledge Test

54.11 Summary

55. A SwiftData Tutorial

55.1 About the SwiftData Project

55.2 Creating the SwiftDataDemo Project

55.3 Adding the Data Models

55.4 Setting up the Model Container

55.5 Accessing the Model Context

55.6 Designing the Visitor List View

55.7 Establishing the Relationship

55.8 Creating the Visitor Detail View

55.9 Modifying the Content View

55.10 Testing the SwiftData Demo App

55.11 Adding the Search Predicate

55.12 Summary

56. Building Widgets with SwiftUI and WidgetKit

56.1 An Overview of Widgets

56.2 The Widget Extension

56.3 Widget Configuration Types

56.4 Widget Entry View

56.5 Widget Timeline Entries

56.6 Widget Timeline

56.7 Widget Provider

56.8 Reload Policy

56.9 Relevance

56.10 Forcing a Timeline Reload

56.11 Widget Sizes

56.12 Widget Placeholder

56.13 Take the Knowledge Test

56.14 Summary

57. A SwiftUI WidgetKit Tutorial

57.1 About the WidgetDemo Project

57.2 Creating the WidgetDemo Project

57.3 Building the App

57.4 Adding the Widget Extension

57.5 Adding the Widget Data

57.6 Creating Sample Timelines

57.7 Adding Image and Color Assets

57.8 Designing the Widget View

57.9 Modifying the Widget Provider

57.10 Configuring the Placeholder View

57.11 Previewing the Widget

57.12 Summary

58. Supporting WidgetKit Size Families

58.1 Supporting Multiple Size Families

58.2 Adding Size Support to the Widget View

58.3 Take the Knowledge Test

58.4 Summary

59. A SwiftUI WidgetKit Deep Link Tutorial

59.1 Adding Deep Link Support to the Widget

59.2 Adding Deep Link Support to the App

59.3 Testing the Widget

59.4 Summary

60. Adding Configuration Options to a WidgetKit Widget

60.1 Reviewing the Project Code

60.2 Adding an App Entity

60.3 Adding Entity Query

60.4 Modifying the App Intent

60.5 Modifying the Timeline Code

60.6 Testing Widget Configuration

60.7 Customizing the Configuration Intent UI

60.8 Take the Knowledge Test

60.9 Summary

61. An Overview of Live Activities in SwiftUI

61.1 Introducing Live Activities

61.2 Creating a Live Activity

61.3 Live Activity Attributes

61.4 Designing the Live Activity Presentations

61.4.1 Lock Screen/Banner

61.4.2 Dynamic Island Expanded Regions

61.4.3 Dynamic Island Compact Regions

61.4.4 Dynamic Island Minimal

61.5 Starting a Live Activity

61.6 Updating a Live Activity

61.7 Activity Alert Configurations

61.8 Stopping a Live Activity

61.9 Take the Knowledge Test

61.10 Summary

62. A SwiftUI Live Activity Tutorial

62.1 About the LiveActivityDemo Project

62.2 Creating the Project

62.3 Building the View Model

62.4 Designing the Content View

62.5 Adding the Live Activity Extension

62.6 Enabling Live Activities Support

62.7 Enabling the Background Fetch Capability

62.8 Defining the Activity Widget Attributes

62.9 Adding the Percentage and Lock Screen Views

62.10 Designing the Widget Layouts

62.11 Launching the Live Activity

62.12 Updating the Live Activity

62.13 Stopping the Live Activity

62.14 Testing the App

62.15 Adding an Alert Notification

62.16 Understanding Background Updates

62.17 Summary

63. Adding a Refresh Button to a Live Activity

63.1 Adding Interactivity to Live Activities

63.2 Adding the App Intent

63.3 Setting a Stale Date

63.4 Detecting Stale Data

63.5 Testing the Live Activity Intent

63.6 Take the Knowledge Test

63.7 Summary

64. A Live Activity Push Notifications Tutorial

64.1 An Overview of Push Notifications

64.2 Registering an APNs Key

64.3 Enabling Push Notifications for the App

64.4 Enabling Frequent Updates

64.5 Requesting User Permission

64.6 Changing the Push Type

64.7 Obtaining a Push Token

64.8 Removing the Refresh Button

64.9 Take the Knowledge Test

64.10 Summary

65. Testing Live Activity Push Notifications

65.1 Using the Push Notifications Console

65.2 Configuring the Notification

65.3 Defining the Payload

65.4 Sending the Notification

65.5 Sending Push Notifications from the Command Line

65.6 Summary

66. Troubleshooting Live Activity Push Notifications

66.1 Push Notification Problems

66.2 Push Notification Delivery

66.3 Check the Payload Structure

66.4 Validating the Push and Authentication Tokens

66.5 Checking the Device Log

66.6 Take the Knowledge Test

66.7 Summary

Index

1. Start Here

This book teaches the skills needed to build iOS applications using SwiftUI, Xcode, and the Swift programming language.

Beginning with the basics, this book outlines the steps to set up an iOS development environment, along with an introduction to using Swift Playgrounds for learning and experimenting with the Swift programming language.

The book also includes in-depth chapters that introduce the Swift programming language, covering data types, control flow, functions, object-oriented programming, property wrappers, structured concurrency, and error handling.

This guide begins with an introduction to key concepts of SwiftUI and project architecture, followed by a detailed tour of Xcode and AI-assisted development using Coding Intelligence. The book also covers how to create custom SwiftUI views, combine them to build user interface layouts, including stacks, frames, and forms.

Other topics covered include data handling using state properties and observable, state, and environment objects, as well as key user interface design concepts such as modifiers, lists, tabbed views, context menus, user interface navigation, and outline groups.

The book also includes chapters covering graphics and Liquid Glass effects, user interface animation, view transitions, and gesture handling, as well as WidgetKit, Live Activities, document-based apps, Core Data, SwiftData, and CloudKit.

Throughout the book, each concept is reinforced with hands-on tutorials and downloadable source code. Additionally, over 50 online quizzes are available to test your knowledge and understanding.

Assuming you are ready to download Xcode and have a Mac, you are now ready to get started.

1.1 For Swift Programmers

This book has been designed to address the needs of both existing Swift programmers and those new to Swift and iOS app development. If you are familiar with the Swift programming language, you can probably skip the Swift-specific chapters. If you are not yet familiar with the SwiftUI-specific language features of Swift, however, we recommend that you at least read the sections covering implicit returns from single expressions, opaque return types, and property wrappers. These features are central to the implementation and understanding of SwiftUI.

1.2 For Non-Swift Programmers

If you are new to programming in Swift, then the entire book is appropriate for you. Just start at the beginning and keep going.

1.3 Source Code Download

The source code and Xcode project files for the examples contained in this book are available for download at:

https://www.payloadbooks.com/product/ios26code/

1.4 Feedback

We want you to be satisfied with your purchase of this book. Therefore, if you find any errors in the book or have any comments, questions, or concerns, please contact us at [email protected].

1.5 Errata

While we make every effort to ensure the accuracy of the content of this book, inevitably, a book covering a subject area of this size and complexity may include some errors and oversights. Any known issues with the book will be outlined, together with solutions, at the following URL:

https://www.payloadbooks.com/ios26errata/

In the event that you find an error not listed in the errata, please let us know by emailing our technical support team at [email protected].

1.6 Take the Knowledge Tests

Look for this section at the end of most chapters and use the link or scan the QR code to take a knowledge quiz to test and reinforce your understanding of the covered topic. Use the following link to review the full list of tests available for this book:

https://www.answertopia.com/g3um

2. Joining the Apple Developer Program

The first step in the process of learning to develop iOS 26 based applications involves gaining an understanding of the advantages of enrolling in the Apple Developer Program and deciding the point at which it makes sense to pay to join. With these goals in mind, this chapter will outline the costs and benefits of joining the developer program and, finally, walk through the steps involved in enrolling.

2.1 Downloading Xcode 26 and the iOS 26 SDK

The latest versions of both the iOS SDK and Xcode can be downloaded free of charge from the macOS App Store. Since the tools are free, this raises the question of whether to enroll in the Apple Developer Program, or to wait until it becomes necessary later in your app development learning curve.

2.2 Apple Developer Program

Membership in the Apple Developer Program currently costs $99 per year to enroll as an individual developer. Organization level membership is also available.

Much can be achieved without the need to pay to join the Apple Developer program. There are, however, areas of app development which cannot be fully tested without program membership. Of particular significance is the fact that Siri integration, iCloud access, Apple Pay, Game Center and In-App Purchasing can only be enabled and tested with Apple Developer Program membership.

Of further significance is the fact that Apple Developer Program members have access to technical support from Apple’s iOS support engineers (though the annual fee initially covers the submission of only two support incident reports, more can be purchased). Membership also includes access to the Apple Developer forums; an invaluable resource both for obtaining assistance and guidance from other iOS developers, and for finding solutions to problems that others have encountered and subsequently resolved.

Program membership also provides early access to the pre-release Beta versions of Xcode, macOS and iOS.

By far the most important aspect of the Apple Developer Program is that membership is a mandatory requirement in order to publish an application for sale or download in the App Store.

Clearly, program membership is going to be required at some point before your application reaches the App Store. The only question remaining is when exactly to sign up.

2.3 When to Enroll in the Apple Developer Program?

Clearly, there are many benefits to Apple Developer Program membership and, eventually, membership will be necessary to begin selling your apps. As to whether to pay the enrollment fee now or later will depend on individual circumstances. If you are still in the early stages of learning to develop iOS apps or have yet to come up with a compelling idea for an app to develop then much of what you need is provided without program membership. As your skill level increases and your ideas for apps to develop take shape you can, after all, always enroll in the developer program later.

If, on the other hand, you are confident that you will reach the stage of having an application ready to publish, or know that you will need access to more advanced features such as Siri support, iCloud storage, In-App Purchasing and Apple Pay then it is worth joining the developer program sooner rather than later.

2.4 Enrolling in the Apple Developer Program

If your goal is to develop iOS apps for your employer, then it is first worth checking whether the company already has membership. That being the case, contact the program administrator in your company and ask them to send you an invitation from within the Apple Developer Program Member Center to join the team. Once they have done so, Apple will send you an email entitled You Have Been Invited to Join an Apple Developer Program containing a link to activate your membership. If you or your company is not already a program member, you can enroll online at:

https://developer.apple.com/programs/enroll/

Apple provides enrollment options for businesses and individuals. To enroll as an individual, you will need to provide credit card information in order to verify your identity. To enroll as a company, you must have legal signature authority (or access to someone who does) and be able to provide documentation such as a Dun & Bradstreet D-U-N-S number and documentation confirming legal entity status.

Acceptance into the developer program as an individual member typically takes less than 24 hours with notification arriving in the form of an activation email from Apple. Enrollment as a company can take considerably longer (sometimes weeks or even months) due to the burden of the additional verification requirements.

While awaiting activation you may log in to the Member Center with restricted access using your Apple ID and password at the following URL:

https://developer.apple.com/membercenter

Once logged in, clicking on the Your Account tab at the top of the page will display the prevailing status of your application to join the developer program as Enrollment Pending. Once the activation email has arrived, log in to the Member Center again and note that access is now available to a wide range of options and resources, as illustrated in Figure 2-1:

Figure 2-1

2.5 Summary

An important early step in the iOS 26 application development process involves identifying the best time to enroll in the Apple Developer Program. This chapter has outlined the benefits of joining the program, provided some guidance to keep in mind when considering developer program membership and walked briefly through the enrollment process. The next step is to download and install the iOS 26 SDK and Xcode 26 development environment.

3. Installing Xcode 26 and the iOS 26 SDK

iOS apps are developed using the iOS SDK and Apple’s Xcode development environment. Xcode is an integrated development environment (IDE) within which you will code, compile, test, and debug your iOS applications.

All of the examples in this book are based on Xcode version 26 and use features unavailable in earlier Xcode versions. This chapter covers the steps involved in installing Xcode 26 and the iOS 26 SDK on macOS.

3.1 Identifying Your macOS Version

When developing with Xcode 26, a system running macOS Sequoia 15.6 or later is required. If you are unsure of the version of macOS on your Mac, you can find this information by clicking on the Apple menu in the top left corner of the screen and selecting About This Mac from the menu. In the resulting dialog, check the macOS line:

Figure 3-1

If the “About This Mac” dialog does not indicate that macOS Sequoia 15.6 or later is running, click on the More Info... button to open the Settings app and check for available operating system updates.

3.2 Installing Xcode 26 and the iOS 26 SDK

The best way to obtain the latest Xcode and iOS SDK versions is to download them from the Apple Mac App Store. Launch the App Store on your macOS system, enter Xcode into the search box, and click the Get button to initiate the installation. This will install both Xcode and the iOS SDK.

3.3 Starting Xcode

Having successfully installed the SDK and Xcode, the next step is to launch it so we are ready to start development work. To start up Xcode, open the macOS Finder and search for Xcode. Since you will use this tool frequently, take this opportunity to drag and drop it onto your dock for easier access in the future. Click on the Xcode icon in the dock to launch the tool. The first time Xcode runs, you may be prompted to install additional components. Follow these steps, entering your username and password when prompted.

Once Xcode has loaded, and assuming this is the first time you have used Xcode on this system, you will be presented with the Welcome screen from which you are ready to proceed:

Figure 3-2

3.4 Adding Your Apple ID to the Xcode Preferences

Whether or not you enroll in the Apple Developer Program, it is worth adding your Apple ID to Xcode now that it is installed and running. Select the Xcode -> Settings… menu option followed by the Apple Accountsentry in the navigation panel. On the Apple Accounts screen, click on the Add Apple Account... button highlighted in Figure 3-3, and enter your Apple ID and password to add the account:

Figure 3-3

3.5 Developer and Distribution Signing Identities

Once the Apple ID has been entered, the next step is to generate signing identities. To view the current signing identities, select the newly added Apple ID in the Apple Accounts panel, followed by the team, as shown in Figure 3-4:

Figure 3-4

On the team panel, click the Manage Certificates… button to display a list of available signing identity types:

Figure 3-5

To create a signing identity, click on the + button highlighted in Figure 3-6 and make the appropriate selection from the menu:

Figure 3-6

If the Apple ID has been used to enroll in the Apple Developer Program, the option to create an Apple Distribution certificate will appear in the menu. Clicking this option will generate the signing identity required to submit the app to the Apple App Store. You will also need to create a Developer ID Application certificate if you plan to integrate features such as iCloud and Siri into your app projects. If you have not yet signed up for the Apple Developer program, select the Apple Development option to allow apps to be tested during development.

3.6 Summary

This book was written using Xcode 26 and the iOS 26 SDK running on macOS Tahoe 26. Before beginning SwiftUI development, the first step is to install Xcode and configure it with your Apple ID via the accounts section of the Preferences screen. Once these steps have been performed, a development certificate must be generated, which will be used to sign apps developed within Xcode. This will allow you to build and test your apps on physical iOS-based devices.

When you are ready to upload your finished app to the App Store, you will also need to generate a distribution certificate. This process requires membership in the Apple Developer Program, as outlined in the previous chapter.

Having installed the iOS SDK and successfully launched Xcode 26, we can now look at Xcode in more detail, starting with Playgrounds.