4 ms·
> Most of this applies to Objective-C. Objective-C’s type system is much poorer than Swift’s, and it lacks a number of expressive operations. The “before” exam
by saagarjha 7y ago
> Most of this applies to Objective-C.
Objective-C’s type system is much poorer than Swift’s, and it lacks a number of expressive operations. The “before” examples are generally how a lot of people would actually write code in Objective-C.
- refulgentis 7y agoWhich ones? I wrote ObjC for 7 years, Swift for 3. I only looked at the first two examples, they both were generic programming advice, nothing to do with the language
- saagarjha 7y agoThe first three. Objective-C doesn't have enums with associated values and it's common to store things in heterogeneous collections or stringly-keyed collections. Creating protocols for generic constraints is also rare–informal protocols (respondsToSelector, anyone?) are instead quite prevalent. And Objective-C's "collection" APIs are much less powerful than Swift's: I might use a regex replacement instead of four calls to replacingOccurrences(of:with:), but it's the same principle.