SwiftUI Apprentice is a series of epic-length tutorials where you’ll learn to build three complete apps from scratch, using Apple’s new user interface technology: SwiftUI! Each app is more advanced than the one before, and together, they cover everything to make your own apps using SwiftUI…
iOS & Swift
Chapter in SwiftUI Apprentice
Apple App Development Ecosystem
Feb 24 2025 · Chapter
…bird's eye view of the whole Apple app development ecosystem with a brief history of SwiftUI, a summary of Apple Developer resources and tips on housekeeping and trouble-shooting…
iOS & Swift
Chapter in SwiftUI Apprentice
Checking Your Tools
Feb 24 2025 · Chapter
…with Xcode installed. If you have an account on GitHub or similar, you can connect to that from Xcode. macOS To use the SwiftUI canvas, you need a Mac running Catalina (V10.15) or later. To install Xcode, your user account must have administrator status. Xcode To install Xcode, you need…
iOS & Swift
Chapter in SwiftUI Apprentice
Planning a Paged App
Feb 24 2025 · Chapter
Plan your app by listing what the user will see and what the app will do. Start learning how to use Xcode, Swift and SwiftUI as you set up a paging tab view…
iOS & Swift
Chapter in SwiftUI Apprentice
Prototyping the Main View
Feb 24 2025 · Chapter
Learn more about Xcode, Swift and SwiftUI while you create subviews to build the most complex view of your…
iOS & Swift
Chapter in SwiftUI Apprentice
Managing Data With Property Wrappers
Feb 24 2025 · Chapter
Learn about the ways SwiftUI manages data through your view hierarchy. Discover how to answer the question "struct or class"? Explore the natural architecture pattern for SwiftUI apps: Model-View…
iOS & Swift
Chapter in SwiftUI Apprentice
Delightful UX — Final Touches
Feb 24 2025 · Chapter
…complete without some snazzy animation. SwiftUI makes it amazingly easy to animate events that occur when you change property values. Transition animations are a breeze. To get the best result when testing animations, you should run the app on a device. Animation timing is sometimes off in preview…
iOS & Swift
Chapter in SwiftUI Apprentice
Outlining a Photo Collage App
Feb 24 2025 · Chapter
…need to overcome. Always take a modular approach and test each aspect of the app as separately from the main app as possible. SwiftUI is great for this, because you can construct views and controls independently using SwiftUI’s Live Preview. When you’re happy with how a view works…
iOS & Swift
Chapter in SwiftUI Apprentice
Paths & Custom Shapes
Feb 24 2025 · Chapter
…preview data. The starter project Shapes Skills you’ll learn in this section: predefined shapes ➤ In the Model folder, create a new SwiftUI View file called Shapes.swift. This file will hold all your custom shapes. ➤ Remove the Shapes structure. You’ll preview your shapes using the SwiftUI canvas preview. ➤ Replace…
iOS & Swift
Chapter in SwiftUI Apprentice
Delightful UX — Layout
Feb 24 2025 · Chapter
Change your user interface to match your designer's vision. Go beyond the basics and learn more advanced SwiftUI layout techniques…
iOS & Swift
Chapter in SwiftUI Apprentice
Saving Files
Feb 24 2025 · Chapter
Codable, you must implement the two synthesized methods yourself. ➤ In the Extensions folder, create a new empty file called AngleExtensions.swift. ➤ Add this code: import SwiftUI extension Angle: Codable { public init(from decoder: Decoder) throws { self.init() } public func encode(to encoder: Encoder) throws { } } You conform Angle to Codable and provide…
iOS & Swift
Chapter in SwiftUI Apprentice
Refining Your App
Feb 24 2025 · Chapter
…been toiling making your app functional, your designer has been busy coming up with a stunning eye-catching design. One of the strengths of SwiftUI is that, as long as you’ve been encapsulating views and separating them out along the way, it’s easy to restyle the UI without…
iOS & Swift
Chapter in SwiftUI Apprentice
Lists & Navigation
Feb 24 2025 · Chapter
SwiftUI List view to present a collection of items in a view that scrolls vertically. Manage a navigation stack in your app's navigation hierarchy with NavigationStack. Use `UIViewControllerRepresentable` to insert the UIKit view controller `SFSafariViewController` in your SwiftUI app. Open URLs in the default browser and download images with…
iOS & Swift
Chapter in SwiftUI Apprentice
Gestures
Feb 24 2025 · Chapter
Gestures are the main interface between you and your app. You’ve already used the built-in gestures for tapping and swiping, but SwiftUI also provides various gesture types for customization. When users are new to Apple devices, once they’ve spent a few minutes with iPhone, it becomes second…
iOS & Swift
Chapter in SwiftUI Apprentice
Moving Data Between Views
Feb 24 2025 · Chapter
…need to manage your app’s data so values flow smoothly through the views and subviews of your app. Managing Your App’s Data SwiftUI has two guiding principles for managing how data flows through your app: Data access = dependency: Reading a piece of data in your view creates…
iOS & Swift
Chapter in SwiftUI Apprentice
Structures, Classes & Protocols
Feb 24 2025 · Chapter
…bottom of the data hierarchy with the element. ➤ In the Model folder, create a new empty file called CardElement.swift and add this code: import SwiftUI struct CardElement { } This is the file where you’ll describe the card elements. You’ll come back to this shortly to define the data…
iOS & Swift
Chapter in SwiftUI Apprentice
Working With Datasets
Feb 24 2025 · Chapter
…your display and management of historical exercise data. Learn to use SwiftUI's Charting package to display the data graphically…
iOS & Swift
Chapter in SwiftUI Apprentice
Adding Photos to Your App
Feb 24 2025 · Chapter
…project, the project is the same as the previous chapter’s challenge project. ➤ In the Card Modal Views folder, create a new SwiftUI View file called PhotosModal.swift and import the framework: import PhotosUI ➤ Replace PhotosModal with: struct PhotosModal: View { @Binding var card: Card // 1 @State private var selectedItems: [PhotosPickerItem…
iOS & Swift
Chapter in SwiftUI Apprentice
Prototyping Supplementary Views
Feb 24 2025 · Chapter
…previous chapter, continue with your project. Or open the project in this chapter’s starter folder. ➤ In the Views folder, create a new SwiftUI View file named HistoryView.swift. For this mock-up, add some sample history data to HistoryView, above body: let today = Date() let yesterday = Date().addingTimeInterval…
iOS & Swift
Chapter in SwiftUI Apprentice
Saving Settings
Feb 24 2025 · Chapter
…button and select iPhone 16 Pro. AppStorage @AppStorage is a property wrapper, similar to @State and @Binding, that allows interaction between UserDefaults and your SwiftUI views. You set up a ratings view that allows the user to rate the exercise difficulty from one to five. You’ll save this rating…