Evolution is predominant. Struggle for Survival applies to just anything that you see. Swift Programming Language is not an exception. Swift continues to change, evolve and mature over time. We can keep our feet wet, migrating year after year to Swift X version. I would. If it strives to be better. This years, Swift 2 -> Swift 3
was little more than a mini project. We saw lots of changes. For this edition, we will focus on [AnyObject: NSObject]
, which became [AnyHashable: Any]
. So does JSON, NSArray and NSDictionary. But why?
We will dive deep, bear with me.
- Swift focuses on using Value Types / immutable type in all cases possible. Foundation in Objective-C, has in other hand, all reference type. Classes. Which will be imported into reference type in swift.
AnyObject
is idiomatically ObjectiveC flavored and is reference type.- Swift is platform independent, it had to move away from relying on ObjectiveC idioms and its runtime. Hence
AnyObject
had to be replace with