How to detect inactivity or no user interaction in iOS App. For showing separate Screen like an Overlay or something like a screensaver. With the following link link that used to present screen overlay when the app became inactive I'm able to show the screen saver in the app. But with normal dismiss view controller code not being able to dismiss the presented view controller.
we are presenting the custom overlay using
// The callback for when the timeout was fired.
func applicationDidTimout(notification: NSNotification) {
let storyboard = UIStoryboard(name: "MyStoryboard", bundle: nil)
let vc =
storyboard.instantiateViewControllerWithIdentifier("myStoryboardIdentifier")
UIApplication.shared.keyWindow?.rootViewController = vc
}
The problem that we are facing in this is. Once the View is presented we are not able to dismiss or remove the view controller.
From @Prabhat Kesara's comment and @Vanessa Forney answer in the helper link. I come with the below solution and it is working fine. If someone comes with the requirement like this they can use this
the difficulty I was faced was presenting overlay or screensaver above an already presented a view. That case, also we are handling in the above solution. Happy coding :)