I have information box object - "Info view". And I wanted to append this view to current VC view, sometimes directly in VC class sometimes outside VC class, ex. in my framework.
I don't want always pass current VC in method argument, like
class InfoView: UIView {
/* Initialization methods */
func show(viewController: ViewController) {
/* some code */
viewController.addSubview(self)
}
}
I want get current VC directly in my "Info view" class:
class InfoView: UIView {
/* Initialization methods */
func show() {
let viewController = /* need get current VC */
/* some code */
viewController.addSubview(self)
}
}
rootViewController
property in UIApplication.sharedApplication()
returns current VC, but after transitions this VC not changed.
How I can get need get current VC?