I'm trying to change text on label when app will enter foreground but I always get
fatal error: unexpectedly found nil while unwrapping an Optional value
ViewController.swift
@IBOutlet var textLabel: UILabel!
func showLabel() {
textLabel.text = "Welcome back"
}
and
AppDelegate.swift
func applicationWillEnterForeground(application: UIApplication) {
ViewController().showLabel()
}
Any Idea how to fix it?