IBM Sends Application Building to the Cloud, via Apple's Swift Language
As covered here, Apple’s Swift programming language, which has been steadily used by both OS X and iOS developers, recently went open source under an Apache licencse. The source code launched along with a port that works with Linux. You can build it from the Swift sources or download pre-built binaries for Ubuntu.
Now, only days after Apple's move, IBM has built and publicized a way to code with Swift in the cloud. The company's IBM Swift Sandbox runs your Swift code on a Linux server using a Docker container. Here are more details.
The IBM Swift Sandbox is an interactive website that lets you write Swift code and execute it in a server environment – on top of Linux. Each sandbox runs on IBM Cloud in a Docker container. In addition, both the latest versions of Swift and its standard library are available for you to use.
Like C, Swift uses variables to store and refer to values by an identifying name. Swift also makes extensive use of variables whose values cannot be changed. These are known as constants, and are much more powerful than constants in C. Constants are used throughout Swift to make code safer and clearer in intent when you work with values that do not need to change.
In addition to familiar types, Swift introduces advanced types not found in Objective-C, such as tuples. Tuples enable you to create and pass around groupings of values. You can use a tuple to return multiple values from a function as a single compound value.
Apple has released two additional projects for Swift in open source: the Core Libraries project, and a new Swift Package Manager project.
Swift Package Manager. The Swift Package Manager is a new project that is used to build and share Swift code. Apple claims it is focused on ensuring the package manager is great at sharing source code, rather than compiled binary libraries. This project is very early in development.
You can find example package repositories at the Apple home on GitHub, as well as the source code and additional information for the package manager itself.
Core Libraries. The Swift Core Libraries project is a higher-level set of APIs, above the Swift standard library. These libraries offer functionality such as localization, networking primitives, unit testing, user preferences, and more. These libraries also introduce coding conventions that can be used as you write more Swift code, and create new packages.
The core libraries are based on frameworks included in Apple platforms, namely Foundation, libdispatch, and XCTest. The Swift open source versions of these frameworks are intended to make it easy to use the same Swift code with consistent functionality across multiple platforms.
If you're interested in getting started with Swift, here are a few more key links from Apple:
- The Swift mailing lists are how to interact
- The Getting Started pages can help you setup a Swift development environment
- The Download page includes pre-built binaries for the supported platforms
- The Swift Evolution Process describes how new features are proposed
- The Apple home on GitHub hosts all the Swift source code