Last active
July 2, 2024 03:36
-
-
Save matsuda/3b06eb3d3081b059035fc80d4b677c78 to your computer and use it in GitHub Desktop.
Completion handler for UINavigationController push or pop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if DEBUG | |
import UIKit | |
extension UIWindow { | |
// WARNING: UIWindowのモーションジェスチャーを奪ってるので、利用する場合は要対応 | |
override open func motionBegan(_ motion: UIEvent.EventSubtype, with event: UIEvent?) { | |
guard motion == .motionShake else { return } | |
let vc = UIViewController() | |
guard vc.parent == nil, | |
rootViewController?.presentedViewController == nil | |
else { return } | |
let navi = UINavigationController(rootViewController: vc) | |
rootViewController?.present(navi, animated: true, completion: nil) | |
} | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment