First Impressions of Swift29 Jun 2016
This morning I began working through the swift tutorial.
The playground is neat.
The synatx is familiar. The
var keywords are comfortable coming from ES6. Built in optionals are nice. The weirdest thing so far is the optional binding in if statements. For example:
I guess it saves you the unboxing shuffle you’d otherwise do, e.g in Java:
It’s interesting how Swift differentiates between structs and classes by how they are passed as arguments. Structs are pass by value and classes/objects are pass by value. Structs can have functions and initializers, just like normal classes. However, structs aren’t compatible with inheritance or type casting. Here’s an example struct in Swift.