What's New in SwiftUI with iOS 17 and Swift 5.9

Updated November 2026. There was never a "SwiftUI 5.9": Swift 5.9 shipped alongside iOS 17, and that's the release this post covers. The examples now use the APIs as Apple shipped them. For the newest release, see What's new in SwiftUI for iOS 27; for the latest design language, Liquid Glass in SwiftUI; for today's concurrency model, see Swift 6.2's approachable concurrency.

iOS 17 and Swift 5.9 were one of SwiftUI's biggest releases. Macros made the Observation framework possible, scroll views finally got first-class paging and position tracking, and MapKit and SwiftData arrived with SwiftUI-native APIs. Everything below needs iOS 17 or later.

Scroll targets and scroll position

scrollTargetBehavior controls where a scroll view comes to rest. .paging stops on whole pages of the scroll view's size; .viewAligned stops on the edges of individual views, which you mark with scrollTargetLayout(). scrollPosition(id:) gives you a binding to the identity of the view that's currently scrolled into place, and setting it scrolls there.

struct CardsView: View {
    @State private var currentCard: Int?

    var body: some View {
        ScrollView(.horizontal) {
            LazyHStack(spacing: 16) {
                ForEach(0..<20) { index in
                    RoundedRectangle(cornerRadius: 24)
                        .fill(.blue.gradient)
                        .overlay(Text("Card \(index)").font(.title).foregroundStyle(.white))
                        .containerRelativeFrame(.horizontal, count: 1, spacing: 16)
                        .id(index)
                }
            }
            .scrollTargetLayout()
        }
        .contentMargins(24, for: .scrollContent)
        .scrollTargetBehavior(.viewAligned)
        .scrollPosition(id: $currentCard)

        Text("Showing card \(currentCard ?? 0)")
    }
}

containerRelativeFrame (also new in iOS 17) sizes each card relative to the scroll view, so one card fills the width on every device.

Observation: @Observable instead of ObservableObject

The Observation framework replaces ObservableObject, @Published and most uses of @StateObject and @ObservedObject. Mark a class @Observable and SwiftUI tracks which properties each view actually reads, so a view only updates when those change, not whenever anything in the object does.

import Observation

@Observable
final class UserProfile {
    var name = "John Doe"
    var age = 30
}

struct ProfileView: View {
    @State private var profile = UserProfile()

    var body: some View {
        Form {
            TextField("Name", text: $profile.name)
            Stepper("Age: \(profile.age)", value: $profile.age)
        }
    }
}

Own the object with @State, pass it down as a plain property, and use @Bindable when a child view needs bindings to it:

struct NameEditor: View {
    @Bindable var profile: UserProfile

    var body: some View {
        TextField("Name", text: $profile.name)
    }
}

The new MapKit for SwiftUI

iOS 17 replaced Map(coordinateRegion:annotationItems:) and MapMarker (now deprecated) with a content-builder API. You put Marker, Annotation, MapPolyline and other map content straight inside Map, and control the camera with a MapCameraPosition.

import MapKit
import SwiftUI

struct ParkMap: View {
    @State private var position: MapCameraPosition = .region(
        MKCoordinateRegion(
            center: CLLocationCoordinate2D(latitude: 37.3349, longitude: -122.0090),
            span: MKCoordinateSpan(latitudeDelta: 0.02, longitudeDelta: 0.02)
        )
    )

    var body: some View {
        Map(position: $position) {
            Marker("Apple Park", systemImage: "apple.logo",
                   coordinate: CLLocationCoordinate2D(latitude: 37.3349, longitude: -122.0090))
                .tint(.red)
        }
        .mapStyle(.standard(elevation: .realistic))
        .mapControls {
            MapUserLocationButton()
            MapCompass()
        }
    }
}

Symbol effects

SF Symbols gained built-in animations. symbolEffect(_:options:value:) plays a discrete effect such as .bounce each time value changes; indefinite effects such as .pulse or .variableColor run while they're applied.

struct NotificationBell: View {
    @State private var ringCount = 0

    var body: some View {
        Image(systemName: "bell.fill")
            .font(.system(size: 44))
            .symbolEffect(.bounce, options: .repeat(3), value: ringCount)
            .onTapGesture { ringCount += 1 }
    }
}

SwiftData

SwiftData is a persistence framework built on Swift macros. Models are classes marked @Model; the macro makes them persistent and observable. Views read them with @Query and write through the modelContext in the environment, which you set up once with .modelContainer(for:).

import SwiftData
import SwiftUI

@Model
final class Todo {
    var title: String
    var isCompleted: Bool

    init(title: String, isCompleted: Bool = false) {
        self.title = title
        self.isCompleted = isCompleted
    }
}

struct TodoListView: View {
    @Query(sort: \Todo.title) private var todos: [Todo]
    @Environment(\.modelContext) private var context

    var body: some View {
        List {
            ForEach(todos) { todo in
                Toggle(todo.title, isOn: Bindable(todo).isCompleted)
            }
            .onDelete { offsets in
                for index in offsets { context.delete(todos[index]) }
            }
        }
        .toolbar {
            Button("Add", systemImage: "plus") { context.insert(Todo(title: "New task")) }
        }
    }
}

@main
struct TodoApp: App {
    var body: some Scene {
        WindowGroup { NavigationStack { TodoListView() } }
            .modelContainer(for: Todo.self)
    }
}

Conclusion

iOS 17 is still a sensible minimum deployment target for many apps, and these APIs are why: Observation alone removes a whole class of over-rendering bugs, and the scroll and map APIs replace code that used to need UIKit. If you're starting a new app today, build on them, then layer the iOS 26 design language on top where it's available.

Want your screens to look as good as the APIs behind them? Effect UI's design styles give your coding agent a complete design system for SwiftUI, with ready-made screens from sign-in to checkout in every style.

More from the blog

DESIGN.md for iOS: Give Your AI Coding Agent a Design System

What a DESIGN.md is, what goes in one for a SwiftUI app (tokens, type, spacing, motion and rules) and how to make Claude Code, Cursor or Codex follow it on every screen.

Liquid Glass in SwiftUI: A Practical Guide for iOS 26

How to use Liquid Glass in SwiftUI on iOS 26: glassEffect, tint and interactive glass, GlassEffectContainer, morphing with glassEffectID, glass button styles and fallbacks.

Swift 6.2 Approachable Concurrency in SwiftUI Apps

Swift 6.2 makes strict concurrency practical for app code: main-actor isolation by default, nonisolated async functions that stay on the caller's actor, @concurrent and isolated conformances.