Monday, November 30, 2015

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 RSS · Twitter

Leave a Comment