Skip to content

Instantly share code, notes, and snippets.

@gamako
Created February 23, 2017 01:42
Show Gist options
  • Save gamako/485a68bfd644d0dcd26688781086696b to your computer and use it in GitHub Desktop.
Save gamako/485a68bfd644d0dcd26688781086696b to your computer and use it in GitHub Desktop.
Template of UIApplicationDelegate without storyboard.
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let vc = ViewController()
let nav = UINavigationController(rootViewController: vc)
let window = { () -> UIWindow in
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = nav
return window
}()
window.makeKeyAndVisible()
self.window = window
return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment