ios – UIApplication has no member shared

ios – UIApplication has no member shared

use for Xcode 7.3.1 by swift 2.2

let appvar = UIApplication.sharedApplication().delegate as! AppDelegate

and for swift 3.x, 4.x, 5 (xcode 8.0 and newer)

let appvar = UIApplication.shared.delegate as! AppDelegate

ios – UIApplication has no member shared

Leave a Reply

Your email address will not be published.