Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SwiftUI → Romit

This map walks through Apple’s SwiftUI documentation topic by topic and shows the Romit way to write each feature. Romit apps compile to the web, so platform-only features (watchOS complications, visionOS immersive spaces, AppKit/UIKit bridges) are out of scope and listed last.

Status: ✅ shipped · 🟡 partial · ⏳ planned

Unlike SwiftUI, Romit apps aren’t Apple-only. The same file renders with an Apple look on iPhone, iPad and Mac and with Google’s Material 3 on Android, Windows and Linux (theme → look auto | apple | material).

Side by side

struct ContentView: View {
    @State private var count = 0
    var body: some View {
        VStack(spacing: 20) {
            Text("\(count)").font(.system(size: 72)).bold()
            HStack {
                Button("−") { count -= 1 }
                Button("+") { count += 1 }.buttonStyle(.borderedProminent)
            }
        }
    }
}
state
  count is 0
screen Home
  column gap 20
    text "{count}" size 72 bold
    row
      button "−" do count -= 1
      button "+" do count += 1
        style prominent

App structure

Every App structure topic in Apple’s docs that applies on the web is shipped. App extensions (widgets, Live Activities) and immersive spaces (visionOS) are Apple-platform only.

SwiftUIRomitStatus
App, WindowGroupapp Name (optional)✅
NavigationStack, NavigationLinkscreens, link "…" to Screen with value, go to Screen✅
navigationDestination(for:)screen Detail with item✅
NavigationPath, deep linksevery screen has a URL (#/Home/Detail~…); browser back and forward work✅
NavigationSplitViewsidebar block in a screen✅
TabView, Tab, .tabItemscreen Home tab "house"✅
.navigationTitle, .navigationSubtitlescreen Home "Title" subtitle "…", titled expr✅
.navigationBarTitleDisplayMode(.inline)inline on the screen line✅
.sheet, .presentationDetentsshow X, show X as half✅
.fullScreenCovershow X as full, cover X✅
.popovershow X as popover✅
.inspectorshow X as inspector✅
.interactiveDismissDisabledlocked✅
@Environment(\.dismiss)close, go back✅
.alert, .confirmationDialogalert "…" message "…", ask "…" + actions✅
.toolbar, ToolbarItem(placement:)toolbar, toolbar leading / title / bottom✅
.searchable, .searchSuggestions, .searchScopessearch … bind q suggest … scopes … scope s✅
search tokens—⏳
scenePhaseon background, on foreground✅
Settings scenescreen Prefs settings (⚙ button, ⌘,)✅
openWindowopen window Screen with …✅
onOpenURLon url✅
DocumentGroupdocument a, b named "file.json" (File menu, ⌘O, ⌘S)✅
.fileImporter, .fileExporteropen file into x as json/text/image, save x to file "…"✅
RenameButton, window sizing and placement, MenuBarExtra—⏳ / ➖
App extensions, immersive spaces—➖

Data and storage

SwiftUIRomitStatus
@Statestate block✅
@Binding, $valuebind value, bind item.field✅
@Observable, @StateObject, @EnvironmentObjectapp-wide state is shared by every screen and view✅
computed propertiescomputed block✅
@AppStorage, @SceneStoragesaved after a state value✅
.onChange(of:)on change of value (screen or app)✅
scenePhaseon background / on foreground✅
.task { await … }, URLSessionon appear + load "url" into value✅
SwiftData / Core Datasaved lists of records🟡

Views

SwiftUIRomitStatus
Text, .font(.largeTitle/.title/.headline/.caption)text, title, heading, subheading, caption, font …✅
string interpolation "\(x)""{x}"✅
Labellabel "Inbox" icon "tray"✅
Image(systemName:)icon "star.fill" (common names)🟡
Image, AsyncImageimage "url"✅
VideoPlayervideo "url"✅
Button, ButtonRole, .buttonStylebutton, role destructive, style prominent/bordered/plain/glass✅
Link, ShareLinklink "…" to "https://…", share value "Share"✅
Toggle, .toggleStyletoggle "…" bind x, style checkbox✅
TextField, SecureField, TextEditorfield, secure, editor✅
.keyboardType, .onSubmit, @FocusStatekeyboard email, on submit, focused✅
Slider, Stepperslider bind v from 0 to 100 step 5, stepper … from 1 to 10✅
Picker, .pickerStylepicker "…" bind x options a, b, c, style segmented/menu✅
DatePicker, ColorPickerdate "…" bind d, colorpicker "…" bind c✅
Menumenu "…" + indented buttons✅
ProgressViewprogress x of total, spinner✅
Gaugegauge v from 0 to 100 "Label"✅
ContentUnavailableViewempty "…" icon "…" message "…"✅
Circle, Rectangle, RoundedRectangle, Capsule, Ellipsecircle, rectangle, rounded, capsule, ellipse + fill✅
Path, Canvas, Swift Charts—⏳

Layout

SwiftUIRomitStatus
VStack, HStack, ZStackcolumn, row, stack✅
LazyVStack, LazyHStackcolumn, row✅
LazyVGrid, Grid, GridItem(.adaptive)grid 3, grid adaptive min 120✅
ScrollViewscroll, scroll horizontal✅
Spacer, Dividerspacer, divider✅
List, Section, .swipeActions(.delete)list, section "…" footer "…", on delete✅
Form, GroupBox, DisclosureGroup, Groupform, box, disclosure, group✅
ForEachfor each x in xs✅
if / else in a view builderif / otherwise if / otherwise✅
ViewThatFits, GeometryReader, custom Layout—⏳
Tablelist of rows🟡

Modifiers

SwiftUIRomitStatus
.padding, .frame(width:height:maxWidth:)padding, width, height, maxwidth, stretch✅
.foregroundStyle, .background, .tintcolor, background, gradient, tint✅
.bold, .italic, .underline, .strikethrough, .monospaced, .textCasebold, italic, underline, strike, mono, uppercase✅
.fontWeight, .lineLimit, .multilineTextAlignmentweight, lines, center/leading/trailing✅
.cornerRadius, .clipShape, .border, .shadowcorner, clip circle, border, shadow✅
.opacity, .blur, .rotationEffect, .scaleEffect, .offset, .zIndexopacity, blur, rotate, scale, offset, z✅
.hidden, .disabledhidden, disabled (with if/unless)✅
.badge, .help, .accessibilityLabel, .textSelectionbadge, help, describe, selectable✅
.preferredColorSchemetheme → dark when x / appearance dark✅
conditional modifiersany modifier + if condition✅

Events, gestures, animation

SwiftUIRomitStatus
.onTapGesture, count: 2on tap, on double tap✅
.onLongPressGestureon long press✅
.onHoveron hover✅
.onAppear, .onDisappearon appear, on disappear✅
Timer, TimelineViewevery 1 second✅
.sensoryFeedbackvibrate✅
withAnimation, .animation, .transitionanimate, animated, transition fade/slide/scale🟡 CSS-based
DragGesture, MagnifyGesture, matchedGeometryEffect—⏳
.keyboardShortcut, .onKeyPressEnter submits fields, Escape closes sheets🟡

Out of scope (platform-specific)

Widgets, Live Activities, App Intents, watchOS and visionOS scenes, UIViewRepresentable and AppKit bridges, Apple Pencil, the Digital Crown, and the Touch Bar.