Feb 28 2023 Swift 5.7, macOS Venture 13.1, Xcode 14.2
Part 1: SwiftUI Views
Prerequisites: Some experience with Xcode and iOS development, with either UIKit or SwiftUI.
Familiarity with the Swift programming language. If you’re new to Swift, check out our Swift courses from the iOS and SwiftUI for Beginners learning path:
- Programming in Swift: Fundamentals
- Programming in Swift: Functions & Types
Hello everyone, I’m Josh, and I’ll be your guide in this SwiftUI Fundamentals course. WWDC 2022 kicked off SwiftUI’s fourth year in developer’s hands, and it’s had some nice improvements each year. You may wonder “What’s so great about SwiftUI?”. Why should I be excited about this?
In Apple’s own words, SwiftUI is the “Shortest Path to a Great App”. It’s a framework for creating user interfaces that dramatically reduces the amount of boilerplate code you need to create great UIs. That means you can focus on what makes your app unique.
In SwiftUI, you define your UI by creating Views. These views are small, manageable UI components that you use to compose larger, more complex hierarchies, declaratively. You’ll usually see SwiftUI compared to creating Imperative UI. In an imperative system, you need to be strict and explicit when describing a user interface.
With declarative UI, you describe the kind of UI you want and trust the framework to render a useable result to the screen. Look how closely the declarative UI style mimics the actual view hierarchy making it much simpler to look at and understand, even if this is the first time you’re looking at this particular hierarchy.
One of the amazing features of SwiftUI is how it translates your code into different appearances based on the context the UI is presented in. When you use controls like buttons or toggles, SwiftUI automatically alters their appearance based on the device and context they’re displayed in.
This lets you to write code that describes your control’s purpose, rather than worrying about how it appears in different environments.
In this course you’ll explore the essential things you’ll need to know to get started building your app’s UI with SwiftUI. It’ll also prepare you for learning more specialized UI topics covered later in this learning path, like Layout and Animation.
You’ll get the most out of this course if you already have some experience developing iOS apps, and a solid foundation in Swift. That may mean you’ve worked a bit building apps with UIKit, and are looking to start experimenting with SwiftUI.
Or, if you already have some SwiftUI experience, maybe from following along with our iOS & Swift for Beginners learning path, this course can give you a quick review of the basics before you move on.
In this course, you won’t be building up a big app. Instead, you’re going to focus on small, contained examples of SwiftUI. In part one, you’ll look at SwiftUI’s basic components and the tools you can use to create and preview them. You’ll also dig into some of the new Swift features that were introduced for SwiftUI.
In part two, you’ll explore navigation and data flow between views in SwiftUI, which can be a little tricky when you first get started.
With SwiftUI, it’s a really exciting time to be a Swift developer. In the next video you’ll get some hands-on experience with it so let’s go!