Random Initial Thoughts on Swift

I started playing with Swift last year after its release but couldn’t keep up the flow because I wasn’t using it at work. I wanted to Re-boot picking up on Swift. I am a fan of  http://www.raywenderlich.com/ books and their style of teaching with hands-on coding examples. I thought I would start doing Swift by Tutorials and document my learnings and experiences as I go along.

Few Random Thoughts:
  1. Although Swift’s type interface promises concise code, I do not know how I feel about it yet, because, I prefer code redability over conciseness. I have to decide on type interface as I go along.
  2. Now removing semi-colons is definitely concise. Although it might take me some getting used to.
  3. Unlike Objective -C the compiler in Swift will pick the right size i.e. 32bit or 64bit for Int types – pretty cool.
  4. A few safety features encountered so far –
    • All numeric type conversions should be explicit
    • Control structures can only use Bool types
    • Accessing out of bounds tuples is a Compile time error, nice!
    • “if” statements require braces even if its just one line of code.
    • Switch doesn’t automatically fall through if you forget to include  break statement in a case.
  5. Thank god I can use strings in Switch statements, and in fact looks like I can use a lot of other things as well.
  6. While using Playgrounds, It struck me that achieving Continuos Integration in iOS world is not as easy as it is in some of the other environments. I know Apple is making a lot of progress with TestFlight, device provisioning, etc but I wish someday it is as simple as writing the code on left side and continually, automatically building & executing code on the right side, just like playgrounds.