I can't really understand why I am getting this error when I call a function on a subclass of UILabel. I have in AppDelegate
class CascadingLabel: UILabel {
func cascade(){
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
self.alpha = 1
}
}
func initializeText(){
print("[OUT21] Init")
}
}
In ViewController,
@IBOutlet weak var Intro1: CascadingLabel!
func initializeText(){
Intro1.initializeText() //Here I am getting error!
}
override func viewDidLoad() {
super.viewDidLoad()
print("[OUT21] OpeningScreen opened")
initializeText()
}
The app crashes, yielding error:
Thread 1: EXC_BAD_ACCESS (code=2, address=0x1b3900ec8)
UPDATE ANSWER: Thanks to @ChristianAbella for the answer here. I didn't indicate the class in the Storyboard.
I think you are getting following error
Everything is fine just assign your class name to UILabel in storyboard