This is gonna be a short and sweet blog post… I’ve been working on a little pet project to practise and learn some Swift, so I thought, what do I use the most in projects these days… its networking. I’ve published on github.com my first attempt Brisk, its no where near complete and only has basic functionality right now, but if it becomes interesting i’ll pick up the effort and add more, until then, its a great educational exercise, you can check it out here and be sure to contribute back 🙂 it should work on both OS X and iOS and is MIT Licensed.
I’ve been at WWDC 2014 all week and one of the major announcements from Apple was a new programming language they’ve been working on named “Swift”, immediately it flashed me back to a really old WWDC where they announced an experimental language they were playing with named “Dylan” but I could be wrong.
Swift attempts to deliver a fast modernised language that looks and behaves as an interpreted language such as Ruby or Python but has all the power of a compiled language such as C++/Objective-C. From what i’ve seen on the interweb and twitter, there seems to have been a mixed reception from developers, but overall its looking more positive than not… My stance is… i’m gonna read more than 60 pages and wait more than 48 hours before declaring either my love or hate for Swift :)… If you’ve seen the blogosphere lately, you’ll understand what I mean.
Apple have released a publicly available (so i’m guessing not under NDA) Swift book on the iBook Store thats lengthy, doesn’t assume you’re an 8 year old and gives a decent overview of the Swift programming language, in what seems is from a “answer all of your questions and thoughts” approach, with some examples and exercises along the way.
I’ve attended the Swift labs almost everyday this week armed with questions, thoughts, suggestions and generally the engineers have been great at responding to everything. As a result i’ve filed radars, been convinced i’m not crazy and had some insight into the future of the language.
My main bone of contentions so far are:
- No sensible/pretty way to selectively expose method A vs method B.
- The threading model is still a little undefined and incomplete.
- Autocomplete and LLDB seem to still be a very much work in progress.
- Downcasting syntax is overly verbose.
- Did I do it wrong? or did Xcode just shit itself?
However having said that, Swift was released early to us the developers, in order to get feedback/suggestions and help Apple build it to how we want… lets not forget, i’ve had (at the time of writing) 96 hours experience in Swift and its only been public for around the same amount of time… so a lot is likely to change.
What I like so far:
- Generally a nicer more modern syntax
- Less “falling back” to C for common things
- Less unnecessary verbosity *(most the time)
- Pretty seamless “bridging”/”interoperability” (or whatever the term should be) to existing Objective-C code
- Namespacing, Modules & Frameworks
- Explicit typing support with some intelligence from the compiler too
- An emphasis on “tell the compiler as much as possible”
As soon as I figure out whether or not we’re allowed to talk about more, i’ll go into more detail on some of these points and post some sample code. I’m currently working on an iOS Framework written in pure swift that I’m sure people will enjoy, i’ll be posting it on GitHub
in the near future here it is now, but its probably far away from prime time and perhaps a little useless 🙂 but a great way to learn Swift!
As always, thoughts and criticisms should be constructive and not defamatory and furthermore, have your own opinion, no one you follow on twitter is an expert on this yet 🙂 so don’t be afraid to voice your opinions and join in the healthy discussion.
If you wanna chat about it more, i’m @ArmstrongAtWork on twitter.