3 comments

[ 2.3 ms ] story [ 18.8 ms ] thread
This is very cool. For anyone who is not familiar with Swift, whatever property variable you declare (unless it's an optional) needs to be initialized in a constructor before the code can even compile.

With structs you get a default constructor that will take care of this for you, however when you define a class you need to take care of this yourself.

Because of this you can find yourself writing a lot of boilerplate code, setting variables in initializers. Having this process automated is something that Xcode has been lacking for sometime. (that and auto generating protocol methods when a class implements it)

struct sample: http://imgur.com/a/wm5MO

class sample: http://imgur.com/a/CpWlk

gist:

https://gist.github.com/kingreza/edd1b449ee3e34c4a9588e678af...

I thought apple was going to allow to put theses on the Mac App Store.
Author here. It's correct that apps like this can be put in the App Store. However I've not chosen to do so because my developer license is not active at the moment. Though I do feel like the installation is quite cumbersome at the moment.