3 ms·
The first example utilizes a feature of Swift's type system which obj-c does not have (enums with associated values) to write code which is better than could be
by plorkyeran 7y ago
The first example utilizes a feature of Swift's type system which obj-c does not have (enums with associated values) to write code which is better than could be done in obj-c. This seems like a perfectly good example of improving code by making it more "Swifty", as one of the distinguishing features of Swift is that it has a more powerful type system than most mainstream languages.
The second example is strange. It's improving the code by making it call the correct method from the standard library rather than the wrong one. I guess that's not bad advice, but I have no idea what it has to do with Swift in particular.
The third one is a missed opportunity. Swift has some unusual ideas around how things should be named (partially inherited from Smalltalk via obj-c, but also partially new), but instead of talking about that it's just generic "give things useful names" advice that has little to do with Swift.