Follow

Has anyone got openWindow to work on iPadOS from the Command menu? Console throws "Use of OpenWindowAction requires the SwiftUI App Lifecycle" (the whole app is). Button works fine when inside a View (and works on Mac)

@phill wow that’s weird.

What I think is happening is that two different instances of OpenWindowAction are being passed: one to the app and the other to the command group by the system. I remember running across similar issues with system-provided environment values in the past.

One (hacky) solution is to pass the known-good openWindow instance to your command group from your app. I just put up a gist that explains this approach. gist.github.com/jaywardell/

@jaywardell thanks for the suggestion and taking the time to write a gist! It does indeed appear the Command environment is quite different (uhh…broken). Passing an action from the App/Scene as you suggested works. It also appears to work as a focused scene value, which has the benefit of not passing it around.

@phill I’d love a Feedback on that. If you have a chance to file let me know the number and I’ll make sure it gets screened.

@curtclifton Just filed for you as FB12988541.

I've also noticed OpenWindowAction is unable to open more than 2 windows of the same type with differing values. Not sure if that's an intended limitation, but it is inconsistent with macOS where it works as expected. Filed as FB12988647. gist.github.com/phillipcaudell

Sign in to participate in the conversation
The Not So Big Company

The home of The Not So Big Company on Mastodon.