Hi, I'm Merrick and I love code so much I married it. Can provide proof upon request.
Jun 3rd 2014
1 min read

Swift Notes

  • Type inference with sane interpolation (which takes expressions yay)! Make for less nasty NSLog.

  • Dictionary & Array literal syntax. Legit. More akin to PHP than JS by syntax.

  • let & var seem to hold for reference semantics not value semantics. Think Scala's val & var.

  • TODO: Does for in take advantage of NSFastIteration protocol? In which case, users could provide iterables?

  • Expression support for control flow! Pattern matching!

  • Ranges. Appear to be lazily computed as expected.

  • Nice overloading of ... to represent variadic functions.

  • First class functions!

  • The closure block syntax is a little odd overloading the in keyword to separate the interface from the implementation.

  • Single line statement closures are implicit return types

  • Classes look freakishly like ES6/Typescript classes.

  • Explicit override for subclasses.

  • Weird implicit "newValue" in setters. You can explicitly set the name if you like though.

  • willSet/didSet I imagine this was done to keep binding logic out of getters/setters.

  • The existential ? operator is just great, reminds me of coffee script.

  • Named parameters only exists in methods? Seems like a choice for Objective-C interoperability, feels odd that functions don't have the same restriction.

  • structs == value classes

  • enums + Pattern Matching reminds me a lot of Scala's case classes.

  • extensions lots like C# so far as I can tell, I'm guessing this will be used to replace Objective-C Categories. Extending built-ins FTW!

  • Protocols now restrict consumers to consuming only methods in the protocol. Awesome!