Swift brought a much stronger type system to Cocoa development, helping to catch more bugs at compile-time, before they ship and affect real users.
But it’s not enough to bring Objective-C patterns to Swift, sprinkle in a few types, and call it done. With a more powerful type system, we are now able to prevent many more invalid states from ever occurring, and can use new patterns for statically ensuring the correctness of our programs.
“Correct Behavior Through Type Safety” is a talk I created and presented at AltConf 2015, explaining how types can be used to ensure correctness, how to prevent the existence of invalid states, and why unit tests are not enough. I also dive into some specific approaches to correctness that take advantage of Swift’s strong type system.
This presentation is primarily aimed at Objective-C and Swift developers, but the discussions of safety and using types to ensure correctness apply to any language with a static (compile-time) type system.