I want to define enclosure method,which can goto an view controller
like
gotopage(currentController,TargetViewController,"targetidentify")
class func gotoPage<T: UIViewController>(currentController:ViewController,targetControllerClass: T.Type,identify:String){
var mTargetViewController:targetControllerClass = currentController.storyboard?.instantiateViewControllerWithIdentifier(identify) as! targetControllerClass
currentController.showViewController(mTargetViewController, sender: currentController)
}
Here is another similar question I have referenced.
The question is as! targetControllerClass
maybe not correct.
and error while building: "targetControllerClass" is not a type.
How can I define this method with Class Type?
selfsender
? This is aclass
method correct?