Monday, November 30, 2015 [Tweets] [Favorites]

Swift init()

Krzysztof Zabłocki:

With Swift strong typing and immutability, there are rules that prevent you from accesing variables until an object is fully initialized.

I do not like having a function do more than one thing, so I like to split my initializers into multiple functions, this becomes problematic.

[…]

We can define private static functions and use that to setup our variables (and we can also put them into private class extension)[…]

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment