Skip to content

Instantly share code, notes, and snippets.

@florieger
Last active August 27, 2020 09:21
Show Gist options
  • Save florieger/0970ff8dee30524c9f8ea5fc62dcb65e to your computer and use it in GitHub Desktop.
Save florieger/0970ff8dee30524c9f8ea5fc62dcb65e to your computer and use it in GitHub Desktop.
Swift AppDelegate without Storyboard / XIB for iOS.
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.backgroundColor = UIColor.black
window?.rootViewController = ViewController()
window?.makeKeyAndVisible()
return true
}
}
@LarsEckart
Copy link

requires updates for swift 3

window = UIWindow(frame: UIScreen.main.bounds)
if let window = window {
    window.backgroundColor = UIColor.blackColor

@florieger
Copy link
Author

@LarsEckart: Adjusted, thx for letting me know 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment