Skip to content

Instantly share code, notes, and snippets.

View DnV1eX's full-sized avatar

Alexey Demin DnV1eX

  • Canada
View GitHub Profile
@DnV1eX
DnV1eX / SceneDelegate.swift
Created July 25, 2020 03:29
Restore calling UIApplicationDelegate methods on UIApplication state change when using UIWindowSceneDelegate.
@available(iOS 13.0, *)
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func sceneWillResignActive(_ scene: UIScene) {
if !UIApplication.shared.connectedScenes.contains(where: { $0.activationState == .foregroundActive && $0 != scene }) {
UIApplication.shared.delegate?.applicationWillResignActive?(.shared)
}
}