Skip to content

Instantly share code, notes, and snippets.

@kostiakoval
Created November 17, 2015 13:38
Show Gist options
  • Save kostiakoval/cbc57e7d9e82d42c9eee to your computer and use it in GitHub Desktop.
Save kostiakoval/cbc57e7d9e82d42c9eee to your computer and use it in GitHub Desktop.
Init Functionality proposal for http://merowing.info/2015/11/swift-init/
class Foo2 {
let controller: UIViewController = Foo2.setupController()
let window: UIWindow = Foo2.setupWindow()
}
private extension Foo2 {
static func setupController() -> UIViewController {
return UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController()!
}
static func setupWindow() -> UIWindow {
let window = UIWindow(frame: UIScreen.mainScreen().bounds)
window.backgroundColor = UIColor.whiteColor()
window.makeKeyAndVisible()
return window
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment