here I have a class function public class func testing() -> Self
:
public extension UIViewController {
public class func testing() -> Self {
return getInstance()
}
}
and a getInstance() -> UIViewController
function which I can't be modified:
public func getInstance() -> UIViewController {
return UIViewController()
}
now, how to cast the return value of getInstance()
function to Self
in testing()
function?
return getInstance() // error
return getInstance() as! Self // error
return getInstance() as! UIViewController // error