SwiftKickMobile / SwiftMessages

A very flexible message bar for UIKit and SwiftUI.
MIT License
7.32k stars 746 forks source link

Support applications which is using UIWindowSceneDelegate. #410

Closed arthurgau0419 closed 4 years ago

arthurgau0419 commented 4 years ago

Set the windowViewController closure when you are using a UIWindowSceneDelegate based application. for example:

var config = SwiftMessages.Config()
config.windowViewController = { windowLevel, config in
    // Get my first and only window scense. 
    if let windowScense = UIApplication.shared.connectedScenes.first as? UIWindowScene {
        return WindowViewController(windowLevel: windowLevel, config: config, windowScense: windowScense)
    } else {
        return WindowViewController(windowLevel: windowLevel, config: config)
    }
}
wtmoose commented 4 years ago

Why not use PresentationContext.windowScene?

arthurgau0419 commented 4 years ago

Cool, I didn't see that when I was making my changes, my SwiftMessages version is still lower then 8.0. I will close this PR. thanks!