Apple has hugely ambitious plans for open-sourced Swift, and hints on what’s coming to iOS

Craig Federighi revealed many interesting tidbits when you read the transcript–and read between the lines–of his talk with John Gruber of Daring Fireball on The Talk Show podcast.

First let me tie this into yesterday’s post by talking about the maturation of iOS by bringing in features from OS X, and then I’ll talk about the hugely ambitious plans to take Swift Everywhere.

iOS-based OS for Laptops

Yesterday I talked about OS X becoming legacy. For that to happen, iOS has to mature to the point where it can handle the laptop/desktop metaphor of an interface primarily driven by keyboard and mouse or trackpad. Here’s a quote from Federighi on where Apple is directing its efforts:

“the team that does the Dock and the window management on OS X, implemented all their new features for El Capitan in Swift and started mass-converting all of their code”

Think about that for a second. Federighi has made clear in this and other interviews that Objective-C isn’t going away. There are millions of lines of Objective-C in Apple’s OSes and software applications. It makes no sense to wholesale convert them to Swift.

So what would you convert to Swift?

Well, anything that you’re actively working on, and adding new features to or porting to another OS. So Federighi’s quote is telling. There has been some enhancements in OS X 10.11 El Capitan in terms of the Dock and window management, but is it enough to rewrite the whole thing in Swift?

It is if you’re also going to integrate some or all of that into an iOS derivative that has to work on ARM as well as Intel.

For an iOS-based operating system to work in a primarily keyboard- and mouse-driven environment, it has to handle a few things. One is “focus”, so that you can move between different parts of a screen using the Tab key. iOS doesn’t have this today, but iOS-based tvOS does. And Steve Troughton-Smith demonstrated that all that code is also (hidden) in iOS 9:

https://twitter.com/stroughtonsmith/status/664633260434157568

What else would one need? Well, iOS lets you have 2 apps side by side, but that’s as fancy as it gets–and that’s fine for the 12.9″ and smaller screens that it runs on. Once you get to 15″, 21″, and 27″ screens, though, you’ll want a more robust windowing environment such as what OS X has. This includes independent, overlapping windows, dragging windows around the screen, maximize, minimize, that sort of thing.

Well, it sounds like Federighi is saying that’s what Apple’s developers have just converted to Swift. How convenient–it could also be adapted at the same time to iOS and the ARM chip architecture. Hmmm.

Swift Everywhere

So what else did Federighi say? Well, he made it clear in no uncertain terms that Apple envisions Swift being used to power everything from scripting to apps to enterprise servers. Sort of like Swift Everywhere.

“So whether you’re scripting your build system or writing web services — and of course writing your mobile applications — we want to make sure that you can invest in Swift in that way and know that it’s going to be available to you everywhere.”

— Craig Federighi, Apple

That’s pretty comprehensive. After reading that, I tweeted this:

https://twitter.com/thenewlou/status/676758499955630080

If Swift can be used for everything from scripting to enterprise back end systems to OS-level frameworks, it becomes the lingua franca for coders and across OSes. Last year I speculated how Apple’s JavaScript Core framework could be used to power iWork scripting across iWork on iCloud (web-based), iOS, and OS X. (It turns out Microsoft is already doing that with Office.) What if, instead, Swift has this role as cross-platform scripting engine? Think how portable that would be. Scripts to automate apps is a big deal in the enterprise, and now it could work across iOS, OS X, and the web.

But it goes even beyond that.

“professors, wanted to use the language… but they needed it to be open source for this to happen”

–Craig Federighi

Apple wants Swift to be used in computer science education, and now as an open-source language it can be.

What’s the benefit to Apple if Swift is open sourced and can be used in education and competing platforms?

When Apple announced Swift last year, I was working at a Microsoft-focused consultancy, leading their mobile efforts. Back then I could see, even without Swift being open source at the time, it had big implications in the enterprise. The article is no longer credited to me, since I left the company, but here’s what I said about Swift in June 2014:

“With new college graduates learning Swift to program their iOS devices, and existing developers tinkering with it at home and on the job, iOS (and OS X) developers will become much more prevalent, easier to hire, and less expensive over time.”

“Think about this: 3 years from now, there will be much more Swift developer talent. Many of these developers won’t even know Objective-C.”

And there I was just thinking about iOS and OS X. Think about Swift on CloudKit, Linux, app scripting, and maybe even client-side web. The more people who know Swift, the more it’s the de facto language, and the larger the pool of developers.

Federighi had more to say:

“IBM, for instance, jumped all over Swift for building their mobile apps, and almost immediately they were coming back to us with, “We really want to use this on the server. How can we get this on the server?” … And our own iCloud team has been completely champing at the bit to be able to apply it in many, many of the things they do. So, I think it’s going to be one of the first break-out uses of Swift. And … so many mobile applications … are part mobile app, part server code. And … very often you want to share parts of code, parts of your model layer, some of your utility libraries”

So it’s clear Apple is thinking about Swift in CloudKit. 4 months ago, I tweeted my theory on that:

https://twitter.com/thenewlou/status/632240478432264192

Another reason to use Swift is its efficiency compared to Java and C#:

Because of Swift’s language design and ARC (automatic reference counting, a memory management technique) instead of garbage collection (another technique), “Apple’s OS and apps are able to run in lower memory footprint, and we’re able to ship with different [i.e., lower] memory footprints than some of our competitors who use languages that don’t have this characteristic.”

–Craig Federighi

But isn’t a whole new language hard to learn? He addresses that, too:

Because Swift is compatible with Objective-C and iOS & OS X frameworks, “on day one Swift wasn’t a restart for the community. It wasn’t a “Hey, let me learn a whole new set of frameworks” or “Let me wait for Apple to create a whole new set of frameworks.” Swift has been this automatic transition”

Federighi even suggests how to go about starting with Swift, even if you think your code is ‘stuck’ on Objective-C:

whether Swift is the right answer for [a development team], or where it’s the right answer. Even teams where, for one reason or another, they can’t jump right on … Objective-C conversion to Swift now. They then use Swift heavily for writing all their unit tests, which is great because then at least as they’re introducing new APIs, they’re experiencing their own APIs in Swift and then … sort of eating their own dog food in that regard.”

It’s something I suggested almost a year ago:

https://twitter.com/thenewlou/status/564171046488915968

The whole Federighi interview on Daring Fireball is a good read, and I highly recommend it.

Swift has matured a lot on its trip to version 2.0, and Apple has laid out a clear path to 3.0 next year. There’s almost no reason not to start new projects in it today, and Federighi makes clear that it’s pretty much the future of computing, certainly at Apple, and arguably everywhere from high school and college education to app scripting and app development to server side enterprise computing.

Seeing where Apple is focusing on Swift internally–such as the Dock and windowing environment–also gives us clues as to the future of OS X and iOS.

Standard

4 thoughts on “Apple has hugely ambitious plans for open-sourced Swift, and hints on what’s coming to iOS

  1. Pingback: Apple’s open source Swift will open the HomeKit door | The Computer Man

  2. Pingback: Apple’s open source Swift will open the HomeKit door - News Press

  3. Pingback: Apple’s open source Swift will open the HomeKit door – Technewsnow.Today

Leave a comment