How to get class name of 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 like this
let appDelegate = UIApplication.sharedApplication().delegate as AppDelegate
let last_screen = appDelegate.popScreens?.lastObject as UIViewController
cant do this.
if last_screen.class != self.navigationController.visibleViewController.class{
//....
}
no class method of UIViewController
i.e last screen
To know your class name you can call something like this:
var className = NSStringFromClass(yourClass.classForCoder)