How do you get the class name of a UIViewController
class in Swift?
In Objective-C, we can do something like this:
self.appDelegate = (shAppDelegate *)[[UIApplication sharedApplication] delegate];
UIViewController *last_screen = self.appDelegate.popScreens.lastObject ;
if(last_screen.class != self.navigationController.visibleViewController.class){
//.......
}
but in Swift I tried:
let appDelegate = UIApplication.sharedApplication().delegate as AppDelegate
let last_screen = appDelegate.popScreens?.lastObject as UIViewController
Can't do this.
if last_screen.class != self.navigationController.visibleViewController.class {
//....
}
no class
method of UIViewController
i.e last screen