Bring multiple windows to your SwiftUI app

RSS for tag

Discuss the WWDC22 Session Bring multiple windows to your SwiftUI app

Posts under wwdc2022-10061 tag

5 Posts
Sort by:
Post not yet marked as solved
0 Replies
92 Views
I'm seeing that the new type-based WindowGroup initializers (i.e. WindowGroup(for: MyType.self) { ... }) are available on macOS, but not iPadOS. The WWDC sessions seemed to imply that this API was available on iPadOS as well. Am I mistaken or is it expected to become available in a later beta?
Posted
by jarod2d.
Last updated
.
Post not yet marked as solved
0 Replies
105 Views
Hey everyone! I'm taking a look at all the new APIs and I'd really love to implement some forms in my app in a new window instead of in a sheet as I'm currently making them. Basically I have a couple of forms that gather data from the user and add new stuff to the database. I initially did this by using the new Window API and dismissing it via the dismiss action in the environment once the user clicks "Add", but when I try to create a new Window it seems like the view keeps its state and doesn't really gets re-created, which means that all the forms contain the previous values that I don't need anymore. Is there any nice way to achieve this? I think that I can make this work by making it a WindowGroup and using the openWindow function that accepts a value and passing a new UUID every time, but I don't think this is a good idea since as mentioned on the talk these values get persisted.
Posted Last updated
.
Post not yet marked as solved
0 Replies
91 Views
.commandsRemoved() does not work for the Window and WindowGroup scenes if it’s the primary group (first one). Then I tried to add new menu using the code .commands {       CommandGroup(replacing: .newItem) {           Button("New Document") {               newDocument { TestDocument() }           }           .keyboardShortcut("n") } But app crashed with error " Expected subclass override" The test app is a document-based app, with a welcome window using the new Window scene.
Posted Last updated
.