For succinct deferred property initialization

My introduction to Apple’s new Swift programming language has been somewhat of a bipolar experience. Initially delighted by modern language features such as type inference and optionals, I rapidly became disappointed with the rigidity of its generics system and its lack of real reflection APIs. As I found out quite painstakingly, these limitations currently render Swift useless for more advanced types of projects (e.g. an IoC container). Remember that Swift is still very much 1.0 and will continue to evolve toward parity with Objective-C in the months to come. I’m not sure whether it’s wise to go full-Swift for production-grade applications just yet.

On a more positive note: the introduction of Swift brings language-level support for lazy loading of instance properties! When combined with the GoF’s Builder Pattern (with closures), it makes for an exceptionally succinct syntax.

Let’s take a look..