Heads-up to any developers out there – there’s a new programming language from Apple, and it sounds like lots of people want to take a bite. Swift was announced on Monday at the World Wide Developers Conference (WWDC) and some are saying it’s the best thing to come out of the conference; but others aren’t so keen.
Apple currently talks in Objective-C, a language it’s spent a fair amount of time on. Swift will build on this, working alongside the new Interactive Playground (which shows the results of code as you type it), to create ‘highly visual programming’ that will take languages to the next level.
On the upside, Swift does have the potential to make Apple’s developers’ lives easier; it could even launch a whole new type of coder into building applications for devices running iOS and Mac OSX operating systems. Converts say that it could make it faster than ever to build apps, regardless of expertise: “It could lower the barrier to entry for Apple developers… It could open a lot of new doors for a lot of people,” says Caylan Larson, an iOS and Mac OS developer. Apple says it wants it to feel familiar to Objective-C users, and the language still gives access to some of the old features – like Cocoa and Cocoa Touch – as well as to new ones like optional typing.
These are some of the highlights of the new lingo, according to Apple: Closures (similar to blocks in C and Objective-C) unified with function pointers; Tuples and multiple return values; Generics; Fast and concise iteration over a range or collection; Structs that support methods, extensions, protocols; Functional programming patterns. Apple says it also designed Swift with safety in mind, and some have already said that it feels more accessible than Objective-C.
One of Swift’s biggest advantages over Objective-C though, is that it does what’s called “automatic garbage collection.” This means that any unneeded information loitering in a machine’s memory will get automatically ditched, saving developers time and energy. This is one reason that Swift fans believe it can reach a much larger number of developers.
On the other side of the coding cake – considering that the announcement has sparked an article called ‘9 things we hate about Objective-C’ – clearly not everyone has fallen in love! And, as with any new language, Swift needs to be learnt, and that takes some serious wo/man hours. This isn’t just me being lazy or melodramatic – there’s some pre-release reading to go with the 500-page guide on iBooks which will steal a fair chunk of your time.
It also maintains the divide between Apple and other vendors, which is – admittedly – what it wants; but practically it may mean it loses the interest of anyone who wants to build software for other machines too. Others say that Apple should have just moved over other modern platforms – like Ruby or Python – and built on that. Having said all that, even if you write something on Swift that only works for Apple but does well, you’re probs still onto a winner.
What do you think of Swift? The future of Apple or something that could rot the company’s potential?