Compose SwiftUIv0.10.0
esc
GuideAPIGitHub
Article

Guide

Everything about Compose SwiftUI, from installation to the Apple frameworks, with examples that compile.

Getting started

Building screens

LayoutStacks, frames, grids, scroll views, geometry and custom layouts: SwiftUI's layout system, driven from Kotlin.Text and imagesText, fonts, localized and Markdown strings, mixed-style text built in Kotlin, labels, SF Symbols, asset and remote images.ControlsButtons, toggles, pickers, text input, menus, progress and forms: native SwiftUI controls bound to Kotlin state, plus custom control styles written in Kotlin.State and dataCompose state, hoisting, view models and flows, effects, SwiftUI environment values, and passing data between Swift and Kotlin.ListsBuild SwiftUI lists from Kotlin data: rows and identity, sections, styles, selection, swipe actions, editing, search, tables and outlines.NavigationPush screens with NavigationStack, build sidebars with NavigationSplitView, switch sections with TabView, fill the toolbar, and keep a Navigation 3 back stack.PresentationPresent sheets, full-screen covers, popovers, inspectors, alerts, confirmation dialogs and file pickers from Kotlin state, and dismiss them cleanly.StylingColors and shape styles, backgrounds and overlays, shapes and clipping, shadows, Liquid Glass, color schemes, tints, built-in and Kotlin-written control styles, and theming patterns.Drawing and animationShapes, custom paths, Canvas drawing in Kotlin, and SwiftUI animations, transitions and effects driven by Kotlin state.Gestures and inputTaps, long presses, drags, pinches and composed gestures, drag and drop, focus, the keyboard, hover, Apple Pencil, URLs and the Digital Crown.AccessibilityVoiceOver labels, traits and actions, element grouping, rotors, accessibility focus, Dynamic Type and reduced motion, and how to test them.

Apple frameworks

Apple framework integrationsMapKit, Swift Charts, StoreKit and the other SwiftUI framework APIs are opt-in: add one Swift file per framework to your target and register it at launch.MapsShow MapKit maps from Kotlin: camera position, markers, annotations and overlays, map styles and controls, selection, MapReader and Look Around.ChartsDraw Swift Charts from Kotlin: marks and plottable values, series and stacking, axes, scales, legends, selection, scrolling, function plots, 3D charts and the chart proxy.In-app purchasesSell products and subscriptions with StoreKit's SwiftUI views from Kotlin: ProductView, StoreView, SubscriptionStoreView, purchase callbacks, offers, store sheets and testing.Photos and mediaPick photos and videos, play video, preview files, react to camera buttons, offer Apple Music and translate text from Kotlin.Web and sign-inEmbed web pages with WebKit's SwiftUI WebView, and sign users in with Sign in with Apple, passkeys, web authentication, the location button and Touch ID.Payments and WalletTake Apple Pay payments, add passes and orders to Wallet, verify identity with Wallet and let users share transactions, from Kotlin.Tips and widgetsShow TipKit tips from Kotlin, style widget and Live Activity content, and write home screen widgets whose timeline and views come from Kotlin.System servicesHealth data access, contacts, Screen Time, Image Playground, journaling suggestions, game saves, schoolwork, certificates, spatial anchors and the other system framework views, from Kotlin.Games and 3DEmbed SpriteKit scenes, SceneKit scenes and RealityKit models in Kotlin screens, and receive game controller input.

Platforms and tools