Dunfey · Hotel WWDC as data, est. 1983
Front desk everything
Years
Topics

2022 EssentialsSwiftDeveloper Tools

WWDC22 · 16 min · Essentials / Swift / Developer Tools

Use Xcode to develop a multiplatform app

Learn how you can build apps for multiple Apple platforms using Xcode 14. We’ll show you how to streamline app targets, maintain a common codebase, and share settings by default. We’ll also explore how you can customize your app for each platform through conditionalizing your settings and code.

Watch at developer.apple.com ↗

Transcript all transcripts

Code shown on screen · 6 snippets

canImport swift · at 8:48 ↗
#if canImport(ARKit)
import ARKit
#endif
Condition Property swift · at 10:02 ↗
#if os(iOS)
@Environment(\.editMode) private var editMode
#endif
Condition View Modifier swift · at 10:13 ↗
#if os(iOS)
.onChange(of: editMode?.wrappedValue) { newValue in
    if newValue?.isEditing == false {
        selection.removeAll()
    }
}
#endif
Condition View swift · at 10:19 ↗
#if os(iOS)
EditButton()
#endif
Computed Property swift · at 11:48 ↗
var thumnailSize: Double {
    #if os(iOS)
    return 120
    #else
    return 80
    #endif
}
Menu Bar Extra swift · at 12:37 ↗
#if os(macOS)
MenuBarExtra {
    MiniTruckView(model: model)
} label: {
    Label("Food Truck", systemImage: "box.truck")
}
.menuBarExtraStyle(.window)
#endif