Why do I see multiple windows with the exact same content sometimes? #27
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
BackgroundRemafoX is fully written in SwiftUI. Unfortunately, as of October 2022 SwiftUI on macOS is still lacking behind a bit. In particular, there's no way to do window management built into SwiftUI, one has to resort back to AppKit APIs for that, but even this is not really thought out (or documented how to do it properly). I'm currently using this approach which kinda works, but unfortunately the closing of windows by a user doesn't seem to properly communicate to the system that the window is closed, leading to this issue. WorkaroundA simple workaround to fix these annoying multiple windows is to simply close all windows and restart RemafoX. Current PlanWhile I might find a proper fix if I play around with things even more – I already invested multiple days into this and at least all windows now are synchronized, so the issue shouldn't be blocking – my current plan is to reimplement the window management once Apple provides proper support in SwiftUI. If you happen to be an AppKit expert (this is my first multi-window Mac app) and have a guess what my problem could be, I'd be happy about any hints that could help me fix this today. Feel free to ping me on Twitter or comment here. |
Beta Was this translation helpful? Give feedback.
Background
RemafoX is fully written in SwiftUI. Unfortunately, as of October 2022 SwiftUI on macOS is still lacking behind a bit. In particular, there's no way to do window management built into SwiftUI, one has to resort back to AppKit APIs for that, but even this is not really thought out (or documented how to do it properly). I'm currently using this approach which kinda works, but unfortunately the closing of windows by a user doesn't seem to properly communicate to the system that the window is closed, leading to this issue.
Workaround
A simple workaround to fix these annoying multiple windows is to simply close all windows and restart RemafoX.
Current Plan
While I might find a prope…