swift what is appdelegate code example
Example 1: how to get appdelegate object in swift
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let aVariable = appDelegate.someVariable
Example 2: swift access appdelegate from viewcontroller
func appDelegate() -> AppDelegate {
return UIApplication.shared.delegate as! AppDelegate
}