Apple Launches Swift Blog as New Language Gains Traction
Apple Inc. on Friday launched a blog for its new Swift programming language, amid signs it's gaining traction in the iOS and Mac OS developer communities.
Registered Apple developers can get started with the language by downloading the xCode 6 beta IDE, according to the initial Swift blog post, which promises "a behind-the-scenes look into the design of the Swift language by the engineers who created it, in addition to the latest news and hints to turn you into a productive Swift programmer."
One such programmer is Andrew Wagner, a freelance developer in Boulder, Colo. "I like the way that Apple is talking about the language and the vision they seem to be executing and I am excited to jump into it early and help shape what it becomes," Wagner said in an e-mail to this site.
While much is made of the number of new programming languages continually being announced (see "How to Keep up with New Programming Languages" on Mashable.com), Swift seems to be creating a big buzz for such a nascent technology, just announced six weeks ago.
In fact, the latest PopularitY of Programming Languages (PYPL) ranking showed Swift cracking the top 10 list. The PYPL is based on Google Trends data.
Another popularity guide, the TIOBE Index
, headlined its July report with: "Swift Enters TIOBE Index at Position 16."
Over at Wired, writer Cade Metz is especially high on Swift, today explaining, "Why Apple’s Swift Language Will Instantly Remake Computer Programming."
In addition to the new Swift blog, Apple has also been busy working on the language itself. At the 9to5mac.com site, Benjamin Mayo last week reported Swift "has received several major improvements" as part of updates to the iOS and OS X 10.10 ("Yosemite") betas.
At Hacker News, while the original Swift post garnered well more than 700 comments, a new post about the esoteric subject of array semantics in Swift immediately prompted much discussion, with 62 comments already. Another even newer post reveals that a GitHub project called SwiftInFlux has been set up to track language features that might change.
Why all the hubbub?
As John K. Waters, this site's editor at large, explained, Swift is "Objective-C Without the Bad Stuff."
Compatibility is another important feature, and just happens to be the subject of Apple's second blog post, published immediately after the welcome message. Apple assured developers any apps written now will be compatible with the iOS 8 and Yosemite releases coming this fall. The company also reminded coders that the language is ready for use now by
itself or side-by-side with proven code in Objective-C, the language Swift was designed to replace.
One caveat, Apple noted, is that devs should carefully manage any frameworks used in Swift projects, as the language and its binary interface will be changing.
"If your project uses frameworks to share code with an embedded extension, you will want to build the frameworks, app and extensions together," Apple wrote. "It would be dangerous to rely upon binary frameworks that use Swift -- especially from third parties. As Swift changes, those frameworks will be incompatible with the rest of your app. When the binary interface stabilizes in a year or two, the Swift runtime will become part of the host OS and this limitation will no longer exist."
Beyond the blog, Apple has provided several more resources, including e-book on iTunes, videos and downloadable code samples.
However, as IDC analyst Al Hilwa noted in the aforementioned post by John K. Waters, Swift's ultimate success will depend on how much it's promoted by Apple and how that promotion is received by developers.
According to Wagner, a front-line developer who has heartily adopted the language, Apple is doing fine so far, but it's early.
"I am very excited about the discussions going on in the developer community," Wagner said. "Apple is participating more than usual and we have a balance of skeptics and people willing to dive into the new language and really push it to do cool things and become better."
Wagner is certainly a developer who has dived into Swift and is making it better. On StackOverflow.com, he has the highest rating of those who have answered Swift questions in the past 30 days and has the fourth-highest rating all-time, having answered more questions than all but two other developers. He has also been active on Swift's Reddit page, with popular posts such as, "7 Cool Features I Have Discovered in Swift So Far."
Wagner works on freelance projects, consults and builds his own apps -- such as Notecards on the iTunes store -- with a focus on iOS development. He admitted a preference for compiled rather than interpreted languages and was excited to see Swift is compiled with static typing and that it features more compile-time safety than most other languages. That's the direction Wagner has wanted to see for some time.
"Swift encourages more deliberate and safe programming," Wagner said. "The compiler catches more errors for you. Swift has the potential to improve both the efficiency of development and the efficiency of the generated code."
He also thinks Swift allows for more readable and expressive code. "It can be jarring at times to switch from Objective-C to Swift," he said. "But for those people familiar with languages like Java, C#, Ruby and C++, the transition is much easier to Swift than it is to Objective-C."
Wagner goes into more technical detail about the top 7 features he has found in Swift in the aforementioned blog post, such as -- to name a few -- the ability to extend structs and literals; keep collections safe and clear; and use functions with the same name as long as they take different types.
But Wagner isn't a typical Apple sycophant. He laces his enthusiasm with real-world observations and cautions. The main problem with Swift, he said, is its young age. "I don't believe it is gaining much traction outside of those extreme early adopters," he said. "Many developers are talking about it and a number of them are excited about it, but they are not using it for real development yet, nor will they be for a while. People spending a lot of time with Swift right now (including myself) are really hedging their bets that the language will gain traction in the coming years."
While he has seen many complaints about the language on StackOverflow, Reddit and in various podcasts -- his favorite learning resource -- he believes they will mostly be solved as the language matures.
For right now, though, he provided a list of the major weak points he has found in the new language:
- The compiler errors are often hard to understand or misleading. This makes it hard for those new to the language, but I fully expect this to be improved over time.
- The generated code is pretty slow at the moment for many tasks. Again, the first task for Apple is making the language work bug free -- they will have plenty of time to improve the speed of the code later. The extra strictness of the compiler leaves lots of opportunities for compiler optimizations that weren't possible in Objective-C, and Apple has a history of optimizing its underlying frameworks and languages to give developers free enhancements to their existing code and apps.
- Swift lacks true reflection, which can be very powerful and useful. There's some ability to look at the objects at runtime, but very few ways to really make use of that information and no way to modify types and runtime. Time will tell if those features will need to be added or if we'll find ways to solve those problems using new techniques. The biggest thing for me that we lose is the ability to do key-value observing. I made heavy use of that in Objective-C to make more declarative and, therefore, bug-free code. Right now, it isn't nearly as easy to do that in Swift.
- Apple claims Swift was developed to work well with its existing APIs, but there are definitely some rough spots and some major opportunities to improve the APIs. Many of those improvements would require losing compatibility with Objective-C. I'm excited for the day Apple can start to make the APIs work better with Swift, but I don’t believe that should come for a while.
- Memory management still requires some pretty advanced knowledge of how computers work and the learning of relatively complex rules. I'm not necessarily a fan of garbage collection, but it would be great if we stopped having to worry about memory management all together except for in the most extreme circumstances. Because I already understand these rules (they are the same as in Objective-C) it isn't a big deal for me, but it makes it much harder to start developing high-quality apps for new developers.
Despite the occasional annoyances with the Swift language and its infancy, Wagner said he will continue his investment in it, foreseeing a bright future.
"I'm a freelance developer and I also develop my own software," Wagner said. "For freelance, I will stick with Objective-C for a while because Swift is still in such a state of flux. For my own mature software, I may start to mix Swift in with the Objective-C once Swift 1.0 is officially released, but I will not be in a rush to convert existing code to Swift.
"I will, however, continue to dedicate time to developing with it for smaller new projects so that I can continue to improve my skills. I will also continue reporting bugs to Apple, blogging about it and answering questions on Stack Overflow and Reddit. I am confident that the time I can make for Swift now will pay off in the future because I am confident that Swift will become widely adopted, at least within the Apple ecosystem."
From the looks of things, he's not alone.