Introduction to Open Source Swift on Linux

Learn how to use open source Swift to run a Hello, World app on Linux – and how to use the Swift package manager! By Alexis Gallagher.

Leave a rating/review
Save for later
Share
You are currently viewing page 3 of 3 of this article. Click here to view the first page.

What Does All This Mean?

Why does a package manager matter so much? It’s because a package manager is more than just a tool. Package managers tend to be inextricably tied to the technical community surrounding a software ecosystem, since they define how people interact with each other in the fundamental business of helping each other to make software.

Would the Ruby or Node communities be the same without the gem and npm package managers? No. And it’s no exaggeration to say that CocoaPods has brought iOS developers closer together by making it easier to share work and help each other.

Apple has a bit of a reputation for communicating to developers; it’s not known for supporting channels for feedback from developers or encouraging developer interaction. A good example of this is the Radar bug tracking system, which functions like an interplanetary black hole, silently gobbling up information, and leaving behind no trace visible from the external universe.

But a package manager is inevitably a piece of community infrastructure; it’s something other developers will use to interact with each other, not with Apple. So it’s a bit of a departure for Apple to take the lead in promoting such a tool.

It’s also a good sign that the tool looks and feels like a normal package manager that uses semantic versioning, Git, and other conventional tools and patterns which originated outside of Apple. Apple’s even replaced Radar with a new bug tracking system for Swift based on JIRA, which allows developers to actually view known bugs. And there’s also a long document that solicits contributions from the open source community and establishes a process and a community code of conduct.

It really feels like the Swift team has rolled out the welcome mat! I imagine it as an eerily opalescent welcome mat, with hairline grey trim, which magically hovers exactly one centimer above the ground so it never gets dirty. Others may see it differently. :]

Welcome to Swift Open Source!

The package manager feels like a sign of the broader spirit behind this open source release. With this open source release, Apple hasn’t just thrown a bunch of code “over the wall”. Apple’s taken the first steps toward supporting production uses of Swift on Linux. And more than that, they’ve made big steps toward encouraging and welcoming others to help with this effort.

Exiting the Virtual Machine

When you’re done with your virtual machine, just use logout to exit the shell, and call vagrant suspend to freeze it for later use, or vagrant destroy to blow it away completely and free up the disk space.

Where to Go From Here?

In this tutorial, you’ve installed Linux, installed Swift on Linux, compiled code using Swift on Linux, and taken a quick look at Apple’s package management tool. The fact that you can now run Swift on Linux is incredibly interesting, but the fact that Apple seems to be actually encouraging it, and providing technical and community support for it, is awesome! :]

You’ve only had a really quick look at Swift on Linux, but a lot of the new tooling such as the package manager has consequences for Swift on OS X as well; it’s now easier to share code and to build command line tools. It’s hard to imagine this doesn’t at least hint of new directions in Xcode. The new repositories, the exposure of the roadmap and discussion process for future Swift development are promising — and surprising — developments.

There are interesting days to come!

What are your thoughts on this new paradigm for Swift development? Share your thoughts with us below!