Swift: Apple's next-generation programming language 4 years in the making
Swift, Apple's new programming language billed as taking the C out of Objective-C, was one of the biggest surprises at WWDC 2014. The Swift project started at Apple roughly 4 years ago as one of several explorations into what would replace the NeXT-era Objective-C language. It was spearheaded by Chris Lattner, head of Apple's developer tools department, who also spearheaded LLVM (lower level virtual machine) and Clang, Apple's compiler technologies. Lattner shared some insight into Swift on his site, nondot:
That Swift won out over existing higher level and scripting language projects is provocative, but it's also early days. Lattner is the only one who has been using Swift since its inception and few even inside Apple, until Monday morning, even knew of its existence.
There's no word on how much, if any, of Swift will be open sourced, for example. Right now Lattner and team are focused exclusively on getting the final release ready for the fall. Swift has also only just been introduced and thousands if not millions of people will soon be hitting it full speed and full force. They'll find edge cases and do things no internal planning or QA (quality assurance) could ever prepare for or expect. Apple will watch, learn, and Swift will change and evolve.
So will the rest of Apple's platforms. Objective-C was the result of Apple buying NeXT. Swift is the result of steady, continuous evolution. It's the result of smart management and responsible stewardship, that, in the fullness of time, will likely result in just as much of a leap forward as a NeXT-style purchase. It's also something more.
In his brief write up Lattner also discusses Playgrounds, the interactive development environment in Xcode. The Web inspector provides immediate feedback for HTML5 and has been a huge boon for web developers. Lattner hopes that, with Playgrounds in Swift, Apple won't just be making programming better but will be making it more fun and accessible to the next generation of programmers. That's an incredibly important and laudable goal.
If there's one thing I've heard repeatedly from developers since Swift's unveiling it's exactly that hope. My generation grew up with Basic and Logo and other languages that made it relatively easy to get programming into elementary schools and kids into programming even at a very young age.
Objective-C was unlikely to be in any grade school curriculum, unlikely to be any child's first programming language. We'll have to wait and see how Swift and Playgrounds fare, but if they really do make it easier to engage new programmers at a younger age the value to Apple, the industry, and the future will be incalculable.
Poetically, the WWDC 2014 (opens in new tab) app crafted by the evangelism team is the first public Swift app to be released. Millions more will follow.
Apple has made the Swift Programming Language Guide available in the iBook Store. Anyone not already a seasoned Objective C programmer thinking of giving it a shot?
- Free - Download now (opens in new tab)
Get the best of iMore in your inbox, every day!
Rene Ritchie is one of the most respected Apple analysts in the business, reaching a combined audience of over 40 million readers a month. His YouTube channel, Vector, has over 90 thousand subscribers and 14 million views and his podcasts, including Debug, have been downloaded over 20 million times. He also regularly co-hosts MacBreak Weekly for the TWiT network and co-hosted CES Live! and Talk Mobile. Based in Montreal, Rene is a former director of product marketing, web developer, and graphic designer. He's authored several books and appeared on numerous television and radio segments to discuss Apple and the technology industry. When not working, he likes to cook, grapple, and spend time with his friends and family.
SLComposeViewController *tweetVC =
[SLComposeViewController composeViewControllerForServiceType: SLServiceTypeTwitter];
[tweetVC setInitialText: @"I'm tweeting in Obj-C"]; // Swift
let tweetVC =
SLComposeViewController (forServiceType: SLServiceTypeTwitter)
tweetVC.setInitialText("I'm tweeting in Swift") You can see the classes (SLComposeViewController) and methods (setInitialText) line up pretty cleanly; for simple stuff like this it's just a matter of moving the syntax around.
If they really wanted to be a good player in the dev universe they would have at least used the same syntax as the more popular languages. And of course, they waited until I release an app written in objective-c and feel like that language is no longer an issue before releasing this new language...