Post

Replies

Boosts

Views

Activity

Reply to How to open a window in SwiftUI?
I have found this also to work. Although I think SwiftUI needs a much better way of supporting multiple macOS Windows. In your AppStruct, although any persistent struct or class can hold a window. Limitations: No idea how to let the system determine the window position or whether it will autosave window information. struct Radio_2App: App {     let someWindow = NSWindow( contentRect: NSRect(x: 0, y: 0, width: 580, height: 300), styleMask: [.titled, .closable], backing: .buffered, defer: false)     var body: some Scene {         WindowGroup() { SomeContentView()         }     func openWindow() {         someWindow.contentView = NSHostingView(rootView: SomeOtherView())         self.someWindow.makeKeyAndOrderFront(nil)     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’21