I'd like to get access to a ViewController from an extension and then override a function from a library which should change variables or invoke methods from a specific ViewController (in this case "ViewController").
How can I do that? Or is there a more recommended option?
(Hint: I don't want to instantiate a new VC)
import PopupDialog
class ViewController: UIViewController {
//e.g. variable and method to access from extension
var score: Int = 0;
func startGame(){
...
}
}
extension PopupDialog{
open override func viewWillDisappear(_ animated: Bool) {
//change variables
//maybe also invoke methods
}
}