I am learning iOS development and the following code is from the book Programming iOS8 by Matt Neuberg. It is an app delegate class to create a window. I do not understand -
- In the second line what is
@UIApplicationMain
and why is it there? Is it a declaration of a global varibale? - What is the purpose of the parameter
didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?
? I don't see it used anywhere in the function body.
import UIKIT
@UIApplicationMain
class AppDelegate : UIResponder, UIApplicationDelegate {
var window : UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
self.window = UIWindow(frame:UIScreen.mainScreen().bounds)
self.window!.backgroundColor = UIColor.whiteColor()
self.window!.makeKeyAndVisible()
return true
}
}