Book License....14
What You Need....16
Book Source Code & Forums....17
About the Authors....19
About the Editors....19
How to Read This Book....20
Chapter 1: Checking Your Tools....22
Getting Started....23
Creating a New Xcode Project....25
A Quick Tour of Xcode....29
ContentView.swift....33
Creating a New SwiftUI View File....40
What Else is in Your Project?....44
Xcode Settings....45
Running Your Project....53
Key Points....61
Chapter 2: Planning a Paged App....62
Making Lists: Views & Actions....63
Creating Pages....65
Grouping Files....72
Passing Parameters....74
Looping....77
Key Points....87
Where to Go From Here?....87
Chapter 3: Prototyping the Main View....88
Creating the Exercise View....89
Creating the Header View....91
Creating the Exercise Structure....104
Playing a Video....108
Creating Timer, Buttons & Rating....112
Challenges....119
Key Points....120
Where to Go From Here?....120
Chapter 4: Prototyping Supplementary Views....121
Laying Out the History View....122
Structuring HistoryView Data....127
Dismissing HistoryView....131
Laying Out the Welcome View....134
Challenge....147
Key Points....149
Where to Go From Here?....149
Chapter 5: Moving Data Between Views....150
Managing Your App’s Data....151
Using State & Binding Properties....152
Setting & Tapping Images....159
Showing & Hiding Modal Sheets....164
One More Thing....170
Key Points....172
Chapter 6: Observing Objects....173
Showing/Hiding the Timer....174
Using an EnvironmentObject....182
Challenge....188
Key Points....188
Chapter 7: Saving Settings....189
Data Persistence....190
Saving Ratings to UserDefaults....190
Data Directories....192
Swift Dive: Strings....200
Thinking of Possible Errors....205
Multiple Scenes....207
Apps, Scenes and Views....210
Restoring Scene State With SceneStorage....211
Key Points....214
Chapter 8: Saving History Data....215
Using Optionals....216
Debugging HistoryStore....219
Swift Error Checking....225
Alerts....226
Saving History....229
Property List Serialization....234
Ignoring the Loading Error....238
Key Points....240
Chapter 9: Refining Your App....241
Neumorphism....242
Creating a Neumorphic Button....243
Styles....244
Abstracting Your Button....248
The Embossed Button....251
@ViewBuilder....254
ViewBuilder Container View....259
Designing WelcomeView....262
Gradients....265
Challenge....271
Key Points....272
Chapter 10: Working With Datasets....273
Accumulating Data....276
Lists....279
Adding Data to the List....285
Charts....294
Privacy....306
Challenge....307
Key Points....308
Where to Go From Here?....308
Chapter 11: Managing Data With Property Wrappers....309
Getting Started....310
Tools for Managing Data....311
Managing UI State Values....313
Accessing Environment Values....320
Managing Model Data Objects....322
Wrapping Up Property Wrappers....328
Key Points....331
Chapter 12: Apple App Development Ecosystem....332
A Brief History of SwiftUI....333
SwiftUI vs. UIKit....334
Apple Developer....337
Housekeeping & Trouble-Shooting....347
Key Points....354
Chapter 13: Outlining a Photo Collage App....356
Initial App Idea....357
Creating the Project....358
Creating the First View for Your Project....359
Refactoring the View....360
Transitioning From List to Card....363
The Navigation Toolbar....365
The Bottom Toolbar....367
Adding Modal Views....373
Challenge....377
Key Points....378
Chapter 14: Gestures....379
Creating the Resizable View....380
Creating Transforms....381
Creating a Drag Gesture....383
Creating a Rotation Gesture....387
Creating a Scale Gesture....391
Creating Custom View Modifiers....392
Other Gestures....398
Type Properties....399
Challenge....404
Key Points....405
Where to Go From Here?....405
Chapter 15: Structures, Classes & Protocols....406
Data Structure....407
Value and Reference Types....408
Swift Dive: Structure vs Class....409
Creating the Card Store....410
Class Inheritance....412
Protocols....413
The Preview Data....416
Listing the Cards....417
Mutability....420
Understanding @State and @Binding Property Wrappers....426
Key Points....432
Where to Go From Here?....432
Chapter 16: Adding Assets to Your App....433
The Asset Catalog....434
Launch Screen....440
Adding Sticker Images to Your App....445
Using Lazy Grid Views....456
Challenges....462
Key Points....463
Where to Go From Here?....463
Chapter 17: Adding Photos to Your App....464
The PhotosUI Framework....465
The PhotosPicker View....465
The Transferable Protocol....470
Drag and Drop From Other Apps....475
Pasting From Another App....482
Adding a Pop-up Menu....484
Challenge....491
Key Points....492
Chapter 18: Paths & Custom Shapes....493
The Starter Project....494
Shapes....494
Paths....496
Strokes and Fills....504
Selecting an Element....506
Associated Types....509
Adding the Frame Picker Modal to the Card....514
Challenges....521
Key Points....523
Chapter 19: Saving Files....524
The Starter Project....525
The Saved Data Format....525
When to Save the Data....526
JSON Files....529
Codable....529
Encoding and Decoding Custom Types....533
Loading Cards....542
Creating new Cards....544
Challenges....547
Key Points....550
Chapter 20: Delightful UX — Layout....551
The Starter app....552
Designing the Cards List....553
Layout....555
Adding a Lazy Grid View....559
Scaling the Card to fit the Device....569
Alignment....576
Challenges....579
Key Points....581
Chapter 21: Delightful UX — Final Touches....582
The Starter Project....583
Animated Splash Screen....583
SwiftUI Animation....588
Animated Transitions....594
Supporting Multiple View Types....597
Sharing the Card....600
Challenges....607
Key Points....610
Where to Go From Here?....610
Chapter 22: Lists & Navigation....612
Getting Started....613
List....613
NavigationStack....614
Using the Internet....617
navigationDestination....622
Using Custom Colors....630
One Last Thing....633
Key Points....637
Chapter 23: Just Enough Web Stuff....638
Servers & Resources....639
REST API....641
Sending & Receiving HTTP Messages....642
Exploring metmuseum.org....646
POST Request & Authentication....652
Key Points....656
Chapter 24: Downloading Data....657
Getting Started....658
URLSession....658
Creating a REST Request URL....660
Sending the Request With URLSession....665
Decoding JSON....666
Downloading Objects....670
Downloading Data in Your App....671
Showing a Progress View....683
Key Points....684
Chapter 25: Widgets....685
Getting Started....686
WidgetKit....686
Adding a Widget Extension....687
Creating Entries From Your App’s Data....694
Creating Widget Views....697
Providing a Timeline Of Entries....706
Deep-Linking Into Your App....715
A Few Last Things....719
Key Points....721
Conclusion....722
You’ve heard about Apple’s hot new declarative user interface SDK — SwiftUI — and are ready to try your hand at iOS development. But, you have no idea where to begin.
SwiftUI Apprentice to the rescue! This book will guide you through the first steps of your journey as you learn to build beautiful iOS apps.
This book for developers who are new to iOS and SwiftUI who are looking for a step-by-step path to learning.
One thing you can count on: After reading this book, you’ll be prepared to create your own iOS apps using SwiftUI.