Closed klaas closed 4 years ago
That is a good suggestion. A potentially workaround is to have SwiftMessages.PresentationContext
target a view or view controller in the desired scene.
Is this what you had in mind?
enum PresentationContext {
windowScene(_: UIWindowScene, windowLevel: UIWindow.Level)
}
This would be great! 😃
@klaas can you try this out on the head of master
and let me know if it works for you?
@wtmoose Just gave it a brief try. The API is fine 😃, but the message view will be centered between my two scenes:
I guess it might relate to having the window as big a the screen?
PassthroughWindow(hitTestView: view, frame: UIScreen.main.bounds)
I can take a deeper look into it tomorrow.
Thank you very much for implementing it!
Yeah, I’m just telling the window to become visible. I haven’t done much with multi-window, so if you’ve got any pointers for how the window should be installed, I’ll take a look.
Using the bounds
of the first window of the scene, solves the layout issues:
var windowBounds: CGRect
switch config.presentationContext {
case let .windowScene(scene, _):
windowBounds = scene.windows.first!.bounds
default:
windowBounds = UIScreen.main.bounds
}
But essentially every app can now have multiple "main" windows. Each scene has it's own window and would be in the need of an independent queue for displaying messages.
🥺 Uh, this seems to be more work than expected.
How about when the bounds change, such as if you rotate or resize the split screen?
Independent queues should be a problem. You can use as many instances of SwiftMessages as you want:
let mainWindowMessenger = SwiftMessages()
mainWindowMessenger.show(...)
Should work correctly now if you'd like to check out the head of master
.
Included in 8.0.0 release
I couldn't find anything regarding support for multiple windows in iOS 13 (see https://developer.apple.com/videos/play/wwdc2019/212/), am I right?
Would be great to see another
SwiftMessages.PresentationContext
case to specify the scene window. In the meantime I'll try to hack something or use theviewController
context.BTW: Really loving Swift Message! Great work!