cezarywojcik / CWStatusBarNotification

A library that allows you to easily create text-based notifications that appear on the status bar.
MIT License
2.03k stars 260 forks source link

Component not working with UIScene #117

Open ppamorim opened 4 years ago

ppamorim commented 4 years ago

If this component is not drawing in your UIScene based application, simply change this line here:

https://github.com/cezarywojcik/CWStatusBarNotification/blob/swift/CWStatusBarNotification/CWStatusBarNotification/CWStatusBarNotification.swift#L267

With:

if #available(iOS 13.0, *) {
    if let firstScene: UIWindowScene = UIApplication.shared
    .connectedScenes.filter({ $0.activationState == .foregroundActive })
    .first as? UIWindowScene {
        self.notificationWindow = CWWindowContainer(windowScene: firstScene)
    }
} else {
    self.notificationWindow = CWWindowContainer(frame: UIScreen.main.bounds)
}