# Compatibility

What the browser build of an app supports today, area by area. Foundation,
the other frameworks and Swift packages are covered in more depth in the
[CLI reference](https://swiftbrowser-docs.pages.dev/cli).

| Area | Supported | Not yet |
|------|-----------|---------|
| Views | `Text`, `Image(systemName:)`, `Image("asset")`, `VStack`, `HStack`, `ZStack`, `Spacer`, `Divider`, `ScrollView`, `List` (incl. `selection:`), `Section`, `Form`, `ForEach`, `Button`, `TextField`, `SecureField`, `Toggle`, `Picker` (segmented, menu, inline), `Menu`, `TabView`, `GeometryReader`, `Label` (+ `LabelStyle`), `Gauge`, `ProgressView`, `Grid`/`GridRow`, `LazyVGrid`/`LazyHGrid`, `TimelineView`, `ViewThatFits`, custom `Layout`, `Chart` (`Charts` module: bar, line, area, point, rule and rectangle marks, axes, legends), `AsyncImage`, `Image(uiImage:)` and `Image(_:scale:label:)` (a `CGImage`), `Color`, shapes (with `fill`/`stroke`/`strokeBorder`), gradients, `Group`, `AnyView`, `EmptyView`, `Slider`, `Stepper`, `DatePicker`, `TextEditor`, `EditButton`, `ContentUnavailableView`, `ShareLink` (Web Share API, else a download) | `LazyVStack`, `Table`, `Canvas`, `Map` |
| Navigation and presentation | `NavigationStack` (destination- and path-based, nested stacks flatten), `NavigationSplitView` (two columns from the regular size class), `NavigationPath`, `NavigationLink` (destination and value), `navigationDestination(for:)`, `navigationTitle`, `navigationBarTitleDisplayMode`, `toolbar`/`ToolbarItem`, `searchable`, `dismiss`, `sheet(isPresented:)`, `sheet(item:)`, `presentationDetents`, `fullScreenCover`, `alert`, `confirmationDialog`, swipe-back | `popover`, `inspector` |
| State and concurrency | `@State`, `@Binding`, `@Observable`, `@Bindable`, `@StateObject`, `@ObservedObject`, `@EnvironmentObject`, `ObservableObject`, `@Environment` (including `colorScheme`, `dynamicTypeSize`, `horizontalSizeClass`, `dismiss`, `scenePhase`, `editMode`, the accessibility flags), `@ScaledMetric`, `onChange(of:)`, `Task`, `.task`, `.task(id:)`, `Task.sleep`, clocks, `Timer.publish` + `onReceive`, `Timer.scheduledTimer`, `@FocusState`, `@Environment(Type.self)` + `.environment(_:)`, `@AppStorage` (kept in localStorage) | `@SceneStorage` |
| Control flow in `body` | `if`/`else`, `if let`, `switch`, optionals, `ForEach` | `for` |
| Modifiers | `padding`, `font`, `bold`, `fontWeight`, `foregroundStyle` (any `ShapeStyle`), `foregroundColor`, `background` (colors, styles, shapes, views), `overlay`, `frame`, `cornerRadius`, `clipShape`, `clipped`, `opacity`, `hidden`, `mask` (gradients and colors), `disabled`, `layoutPriority`, `lineLimit`, `multilineTextAlignment`, `fixedSize`, `aspectRatio`, `offset`, `position`, `rotationEffect`, `scaleEffect`, `shadow`, `badge`, `tint`, `imageScale`, `animation(_:value:)`, `transition`, `buttonStyle`, `textFieldStyle`, `listStyle`, `pickerStyle`, `labelStyle`, `gaugeStyle`, `tabItem`, `tag`, `environment`, `dynamicTypeSize`, `onAppear`, `onTapGesture`, `task`, `gesture` (`DragGesture`, `LongPressGesture`, `TapGesture`), `onLongPressGesture`, `allowsHitTesting`, `swipeActions`, `contextMenu`, `onDelete`, `onMove`, `refreshable`, `rotation3DEffect`, `blur`, `ignoresSafeArea`, `ViewModifier` via `modifier`, `focused`, `onSubmit`, `submitLabel`, `preferredColorScheme`, `scrollTargetBehavior`, `scrollTargetLayout`, `containerRelativeFrame`, `visualEffect` (static) | `MagnifyGesture`, `RotateGesture`, `matchedGeometryEffect`, view masks |
| Types | `Font` (text styles scale with Dynamic Type), `Color`, `ShapeStyle` (hierarchical, gradients, materials), `Animation` (`withAnimation`, springs, `repeatCount`/`repeatForever`, `Binding.animation`), `AnyTransition` (incl. asymmetric, `modifier(active:identity:)`), `Alignment`, `EdgeInsets`, `Angle`, `UnitPoint`, `StrokeStyle`, `Shape`s, `EnvironmentValues`, `ColorScheme`, `DynamicTypeSize`, `UserInterfaceSizeClass`, `PresentationDetent`, `LocalizedStringKey`, `ScenePhase`, `EditMode`, `ButtonRole`, `IndexSet`, `CharacterSet` and Foundation's `FormatStyle`s, `FocusState`, `SubmitLabel`, `ScrollTargetBehavior`, `VisualEffect`, `Transaction` (accepted), `URLSession`, `URLRequest`, `HTTPURLResponse`, `URLError` (over the browser's `fetch`), `UIImage` (from data, a `CGImage` or `CIImage`, a symbol or a catalog name), `CGImage` (`cropping(to:)`) | `Path`, `GraphicsContext`, `UIImage.pngData()` / `jpegData` |
| SwiftData | `@Model`, `@Attribute` (`.unique`), `@Relationship` (delete rules, inverses), `@Transient`, `ModelContainer`, `ModelConfiguration` (named, in memory), `ModelContext` (insert, delete, fetch, `fetchCount`, save, rollback, autosave), `FetchDescriptor`, `@Query`, `#Predicate`, `SortDescriptor`, `.modelContainer`, `.modelContext`, `\.modelContext`, kept in IndexedDB | `@ModelActor`, history, CloudKit sync, undo |
| Files | `URL.documentsDirectory`, `.applicationSupportDirectory`, `.cachesDirectory`, `.libraryDirectory`, `FileManager` and `Data` / `String` file reading and writing in the app's home, kept in IndexedDB; `/tmp`; `Bundle.main` resources (read only) | file coordination, iCloud Drive, `fileImporter` / `fileExporter` |
| Other frameworks | StoreKit's `requestReview` (a no-op), Core Location's `CLLocationCoordinate2D`, LocalAuthentication's `LAContext` (always succeeds), UserNotifications (Notification API, while the page is open), the CodeScanner package (simulated data; the camera with `BarcodeDetector`), pure-Swift packages from the Xcode project, Core ML's Create ML tabular models (GLMs, tree ensembles and their pipelines, compiled from the target's `.mlmodel` files), PhotosUI's `PhotosPicker`, `PhotosPickerItem` (`loadTransferable` for `Data` and `Image`), `PHPickerFilter` and `.photosPicker(isPresented:)` (the browser's file chooser), UniformTypeIdentifiers' `UTType`, Core Image: `CIImage` (`cropped`, `clampedToExtent`, `applyingFilter`, `applyingGaussianBlur`), `CIContext.createCGImage`, `CIFilter` (by name or `CIFilterBuiltins`: sepia tone, crystallize, edges, Gaussian blur, pixellate, unsharp mask, vignette, QR code generator) | in-app purchases, location services, real biometrics, neural network, image and text models, the photo library itself (`PHAsset`, `PhotosPicker` styles), other Core Image filters, custom kernels, notification actions and responses |
| App | `@main`, `App`, `WindowGroup` | multiple scenes |

Anything outside the matrix is a compile error in the browser build, never a
silent misrender. The example apps are type-checked against Apple's SwiftUI in
CI, so everything in the "Supported" column is known to be source-compatible.
