Call extension function

How can I call extension function, so that the button is encouraged to call the view.
I made a UiButton Extension with a function to animate a button, and everything works, but only if I call it from:
@IBAction func botonVuelta(_ sender: UIButton) {
sender.pulsarAnimacion()
}
but if you called it from viewDidLoad it doesn’t work:
override func viewDidLoad() {
super.viewDidLoad()
botones.layer.cornerRadius = 40
botones.pulsarAnimacion()
}
I’d appreciate it if you could give me a solution,
I thank you in advance

I already solved it.

Preformatted textoverride func viewDidLoad() {
super.viewDidLoad()
botones.layer.cornerRadius = 40
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
botones.pulsarAnimacion()
}

@jbenito Thank you for sharing the solution - much appreciated!

This topic was automatically closed after 166 days. New replies are no longer allowed.