Is there a way for me to determine the ViewController that was active when a user hits the Home button and the app delegate function applicationDidEnterBackground function is called?
            Asked
            
        
        
            Active
            
        
            Viewed 768 times
        
    1 Answers
1
            So this line:
let vc: UIViewController = self.window!.rootViewController!
will give you the root view controller in Swift (assuming that you use that line in some method inside AppDelegate), but if you have containers (such as UITabBarController) -- you may need to go on that hierarchy for additional checks/inspections...
        ppalancica
        
- 4,236
 - 4
 - 27
 - 42