bzf,
@bzf@stormlight.space avatar

Does anyone know how to make a separate sign in window in like how @Sketch presents a separate window until you sign in? Do you conditionally render WindowGroups, or do you render them all and prevent the user from opening them somehow? 🤔

rafa,
@rafa@mastodon.design avatar

@bzf we're not using SwiftUI for the window management part here (although the views are), but yeah I would just spin up a simple AppDelegate to check and open the appropriate WindowGroup.

bzf,
@bzf@stormlight.space avatar

@rafa from what little I tested it seemed that my WindowGroups would appear in the menu bar as well, but maybe there’s some way disable that in SwiftUI.

Is there any benefit to present separate window groups instead of changing the content of only one window that you know of? 🤔

Thanks for the reply, I’ll try and revisit the multiple window approach 🪟

rafa,
@rafa@mastodon.design avatar

@bzf in this case I think you'd also want to auth window to be smaller than the main one. I guess you could just present everything on the same one… but it's less Mac-like? 😅

ctietze,
@ctietze@mastodon.social avatar

@bzf Is not using SwiftUI an option? 😬

bzf,
@bzf@stormlight.space avatar

@ctietze I mean, if that's what it takes, then maybe 😅

ctietze,
@ctietze@mastodon.social avatar

@bzf with plain AppKit you can control which windows to spawn when (and close them).

I have tried multi-window approaches (ab)using SwiftUI window IDs and the experience was very limited.

My takeaway for 2024 is to approach a paywall/login like this:

  1. Launch the app
  2. If not logged in, show the login window
  3. Once logged in, show the main app window (or NSDocuments)

You can easily use SwiftUI for content. But trying to escape NSWindowController is tough.

bzf,
@bzf@stormlight.space avatar

@ctietze Interesting, it sounds kinda similar to using the openWindow and dismissWindow environment things in SwiftUI 🤔 What APIs should I look at for doing something like this? Right now I have a custom NSApplicationDelegateAdaptor in my SwiftUI app, is that where I would check for which window to create?

I've mostly done SwiftUI so don't that much about what APIs that was before it 😄

bzf,
@bzf@stormlight.space avatar

@ctietze I've been trying some things out and landed on this - it seems to behave as I want when being signed in/out and resizes the main window accordingly, and also seems to behave as expected when opening it in the dock (since there's only one window).

Guess it won't work for multiple windows of the same app, but that's not something I intend to do now anyways, so might run with this for a bit and see how it goes 😄

ctietze,
@ctietze@mastodon.social avatar

@bzf yeah, showing different 'scenes' in the main window works with a shoebox-style app, too, of course :)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • SwiftUI
  • kavyap
  • thenastyranch
  • cubers
  • ethstaker
  • InstantRegret
  • DreamBathrooms
  • ngwrru68w68
  • magazineikmin
  • everett
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • GTA5RPClips
  • JUstTest
  • khanakhh
  • normalnudes
  • osvaldo12
  • cisconetworking
  • provamag3
  • Durango
  • tacticalgear
  • modclub
  • Leos
  • megavids
  • tester
  • anitta
  • lostlight
  • All magazines