Created
May 17, 2016 07:12
-
-
Save ksmandersen/6cb6e6607cc101fe552821cf87f7cf3e to your computer and use it in GitHub Desktop.
Eliminating boilerplate code with Generic’s in Swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyAwesomeViewConroller: UIViewController { | |
var awesomeView: MyAwesomeView { | |
return view as MyAwesomeView | |
} | |
init() { | |
super.init(nibName: nil, bundle: nil) | |
} | |
override func loadView() { | |
view = MyAwesomeView() | |
} | |
override func viewDidLoad() { | |
awesomeView.titleLabel.text = "This is awesome" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment