I have a class in which I need to get a reference to one of the child views of my UIViewController, for example I need to change the text in every UIViewController from one swift class.
So this is my class:
class CustomClass: UIViewController {
var button: UIView!
func initClass(controller: UIViewController){
button = controller.view.getViewByIdentifier("button")
}
func changeButtonText(){
button.text = "changed!"
}
}
with this call I can then initialize it in every UIViewController and change the text with only one method.
But how can I get the reference to the button in each view?