Whisper
Whisper copied to clipboard
SceneDelegate 不能出现
swift5 iOS13之后,有SceneDelegate,导致Whisper `let murmur = Murmur(title: "This is a permanent whistle...", backgroundColor: UIColor.red, titleColor: UIColor.white)
Whisper.show(whistle: murmur, action: .present)`
失效,无法显示
Strange @kou8910, can you reproduce it in the demo project?
[ WhisperDome.zip ](url)
` let murmur = Murmur(title: "This is a permanent whistle...", backgroundColor: UIColor.red, titleColor: UIColor.white)
Whisper.show(whistle: murmur, action: .present)`
let murmur = Murmur(title: "This is a small whistle...", backgroundColor: UIColor(red: 0.975, green: 0.975, blue: 0.975, alpha: 1))
不起作用
奇怪的@ kou8910,可以在演示项目中重现吗?
已经上传 你看下
找到问题了
iOS 13 之前
var whistleWindow: UIWindow = UIWindow()
iOS 13 之后 需要改成
if #available(iOS 13.0, *) { if let firstScene: UIWindowScene = UIApplication.shared.connectedScenes.filter({ $0.activationState == .foregroundActive }).first as? UIWindowScene { whistleWindow = UIWindow(windowScene: firstScene) } else { whistleWindow = UIWindow() } } else { whistleWindow = UIWindow() }
解决了这个问题,希望更新下
Thanks @kou8910!