I enjoy making and playing with little DSL-ish extensions for Cocoa types in Swift. For instance, the code below allows me to write cool
storyboard.VC["foo_bar"]
storyboard.VC.initial
instead of:
storyboard.instantiateControllerWithIdentifier("foo_bar") as NSViewController
storyboard.instantiateInitialController() as NSViewController
Of course I could've just as well extended NSStoryboard with a method like .getVC()
, but this is all just for fun anyway ;)
Previously in Swift Extensions: