Benefits of Cocoa: Still here in Swift
Until now we all agreed these were benefits of Cocoa:
* C compatibility
* Dynamic dispatch
* Nil safety
* Duck typing
Now they're all bad?
— Nick Lockwood (@nicklockwood) August 6, 2014
Sigh.
Okay, letβs take this one item at a time:
C compatibility
Nil safety
Was never there in Objective-C, and Swift improves on it.
Duck typing
Having a more capable type system means we can lean on it instead of duck typing. For whatever itβs worth, I rarely used duck typing in Objective-C as it is; typically I either lean more heavily on the class hierarchy or introduce a protocol instead. (I may go into this in more detail in a later blog post.)
Dynamic dispatch
Will be missed, but it does appear Swift will somewhat handle this as well, and I would expect more developments in new language versions.