Learnr

Learn SwiftUI

Describe your interface in Swift and let it update itself when data changes.

Free to start. No credit card. Or browse all courses.

What's inside your SwiftUI course

A sample path Learnr builds for SwiftUI. Your real course adapts to your goal and level.

  1. Swift essentials for SwiftUI: structs, protocols and closures
  2. Views, stacks, modifiers and layout
  3. State and data flow: @State, @Binding and @Observable
  4. Lists, ForEach, forms and user input
  5. Navigation, sheets and app structure
  6. Async data, persistence with SwiftData and shipping to a device

SwiftUI is Apple's declarative framework for building interfaces on iPhone, iPad, Mac, Apple Watch and Vision Pro. Instead of wiring up views and updating them by hand as in UIKit, you describe what the screen should look like for the current state, and SwiftUI redraws the parts that change. The core ideas are small structs that conform to View, chains of modifiers, and property wrappers such as @State and @Binding that define who owns each piece of data. Learnr builds a SwiftUI course of short lessons and practice tasks, starting from layout and moving toward a complete app.

How to learn SwiftUI, step by step

  1. Learn enough Swift to read SwiftUI code. You need structs, optionals, closures, protocols and some generics. Trailing closure syntax appears everywhere in SwiftUI, so get comfortable with it in a playground before opening a SwiftUI project.
  2. Lay out screens with stacks and modifiers. Rebuild a few real screens, like a settings page or profile card, using VStack, HStack, Spacer and padding. Notice that modifier order matters: padding before background gives a different result from background before padding.
  3. Understand who owns each piece of state. Use @State for data a view owns, pass a @Binding to child views that edit it, and move shared data into an @Observable class. Most confusing SwiftUI bugs come from storing the same data in two places.
  4. Build lists from identifiable data. Make your models conform to Identifiable so List and ForEach can track rows correctly. Add swipe to delete, a search field and a detail screen pushed with NavigationStack.
  5. Fetch real data asynchronously. Call a public JSON API inside a .task modifier, decode it with Codable, and show loading, empty and error states. This is where many tutorial apps stop short, so build all three.
  6. Ship one small app end to end. Finish a habit tracker or recipe app, run it on your own device, and persist data with SwiftData. Pair the project with short daily Learnr lessons so property wrapper rules stay sharp.

What you'll learn

  • Compose screens from VStack, HStack, ZStack, List and custom views
  • Choose between @State, @Binding, @Observable models and @Environment for data
  • Build navigation with NavigationStack and sheets
  • Load data asynchronously with the .task modifier and async/await
  • Use Xcode previews to iterate on layouts for different devices and color schemes

How long does it take to learn SwiftUI?

If you already know Swift, expect 4 to 8 weeks at 5 hours a week to build simple multi-screen apps. Starting from zero programming, plan on 3 to 6 months including Swift itself. Advanced layout, animation and performance tuning keep improving with each app you ship.

What you need before you start

A Mac with a recent version of Xcode is required. Basic Swift knowledge helps a lot, and if you are new to programming, start with Swift fundamentals first.

Common mistakes to avoid

  • Creating an observable model inside a view body or with the wrong wrapper, so it resets on every redraw. Create it once with @State or higher up the hierarchy.
  • Stacking modifiers in random order and being surprised by the layout. Read the chain top to bottom as successive wrappers around the view.
  • Targeting only the newest OS without checking your audience. APIs like @Observable need recent versions, so decide your minimum deployment target early.

How Learnr builds your course

Type your topic

Tell Learnr you want to learn SwiftUI, or get as specific as you like.

Get a personalized course

Learnr instantly builds a full SwiftUI course tailored to your goal and skill level.

Learn and level up

Move through bite-sized lessons and interactive practice, earning XP and keeping your streak.

SwiftUI questions, answered

Should I learn SwiftUI or UIKit first?

For new apps, start with SwiftUI. It is the direction Apple is investing in and is faster for most screens. Learn enough UIKit later to read older codebases and to wrap UIKit components SwiftUI does not cover.

Can I learn SwiftUI without a Mac?

You can study Swift and read SwiftUI code anywhere, but building and previewing SwiftUI apps requires Xcode, which runs only on macOS. Some learners rent a cloud Mac or start on an older used one.

Explore more courses

More programming and tech courses

See all programming and tech courses

Ready to learn SwiftUI?

Start your free, personalized SwiftUI course in seconds. It will be typed in and ready when you get there.

Start learning SwiftUI

Free to start. No credit card.