File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,10 @@ public final class EventGenerator {
141141 }
142142 }
143143
144+ if let hammerWindow = self . window as? HammerWindow , !hammerWindow. viewControllerHasAppeared {
145+ return false
146+ }
147+
144148 return true
145149 }
146150
Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ final class HammerWindow: UIWindow {
88 return . zero
99 }
1010
11+ var viewControllerHasAppeared : Bool {
12+ return self . hammerViewController. hasAppeared
13+ }
14+
1115 init ( ) {
1216 super. init ( frame: UIScreen . main. bounds)
1317 self . rootViewController = self . hammerViewController
@@ -41,6 +45,8 @@ private final class HammerViewController: UIViewController {
4145 override var shouldAutomaticallyForwardAppearanceMethods : Bool { false }
4246 override var prefersStatusBarHidden : Bool { true }
4347
48+ var hasAppeared = false
49+
4450 override func viewDidLoad( ) {
4551 super. viewDidLoad ( )
4652 self . view. backgroundColor = . clear
@@ -56,6 +62,16 @@ private final class HammerViewController: UIViewController {
5662 ] )
5763 }
5864
65+ override func viewDidAppear( _ animated: Bool ) {
66+ super. viewDidAppear ( animated)
67+ self . hasAppeared = true
68+ }
69+
70+ override func viewWillDisappear( _ animated: Bool ) {
71+ super. viewWillDisappear ( animated)
72+ self . hasAppeared = false
73+ }
74+
5975 func presentContained( _ viewController: UIViewController ) {
6076 viewController. beginAppearanceTransition ( true , animated: false )
6177 self . addChild ( viewController)
You can’t perform that action at this time.
0 commit comments