Thanks for those ideas. Now for a harder case, in which I need to do something of the form:
var body: some Scene {
if #available(macOS 13.0, *) {
WindowGroup {
AppView()
}
.defaultSize(CGSize(width: w, height :h))
.defaultPosition(UnitPoint(x: x, y: y))
} else {
WindowGroup {
AppView()
}
}
}
A SceneBuilder doesn't accept a control flow statement in its closure (like View does - your example earlier)
var body: some Scene {
WindowGroup {
AppView()
}
if #available(macOS 13.0, *) {
.defaultSize(CGSize(width: w, height :h))
.defaultPosition(UnitPoint(x: x, y: y))
}
}
Were this a View I could perform the platform conditional in a View extension using a ViewModifier to but there's no SceneModifier equivalent.
My high-level challenge is to write a SwiftUI app that runs in macOS from Monterey to Sequoia, hence the need to condition out features missing in earlier generations.
Topic:
UI Frameworks
SubTopic:
SwiftUI