Swift in the Cloud
Buy Rights Online Buy Rights

Rights Contact Login For More Details

More About This Title Swift in the Cloud

English

Write and run Swift language programs in the Cloud

Written by the team of developers that has helped bring the Swift language to Cloud computing, this is the definitive guide to writing and running Swift language programs for cloud environment. In Swift in the Cloud, you'll find full coverage of all aspects of creating and running Swift language applications in Cloud computing environments, complete with examples of real code that you can start running and experimenting with today.

Since Apple introduced the Swift language in 2014, it has become one of the most rapidly adopted computer programming languages in history—and now you too can start benefitting from using the same programming language for all components of a scalable, robust business software solution.

  • Create server applications using Swift and run them on pay-as-you-go cloud infrastructure
  • Quickly write and test Swift code snippets in your own cloud sandbox
  • Use Docker containers to deploy Swift applications into multiple cloud environments without having to change code
  • Grasp the elements and structure of the Swift.org open technology project
  • Find out how to avoid the complexities of runtime configuration by using Cloud Foundry buildpacks for Swift
  • Build high performing web applications and REST APIs with an open source Swift based web server framework
  • Scale up your cloud services by running Swift modules in an asynchronous, open source, 'serverless' cloud environment

Whether you are already using Swift to build mobile applications or a seasoned web developer, Swift in the Cloud will help you leverage server-side Swift to power your next generation of applications.

English

LEIGH WILLIAMSON is a technical leader in the IBM Cloud team who aids clients with cloud computing strategy and execution.

JOHN PONZO is an IBM Fellow and the primary technical collaborator between Apple and IBM in refining Swift for both mobile client and cloud services development.

PATRICK BOHRER is technical lead for IBM's global efforts around Swift@IBM Engineering.

RICARDO OLIVIERI is an expert in the adoption of the Swift language on the server and the IBM cloud.

KARL WEINMEISTER helped extend Swift from its mobile roots to become a full-stack language ecosystem.

SAMUEL KALLNER is technical lead of the Kitura project at the IBM Research Lab in Haifa, Israel.

English

Introduction xxiii

1 Swift.org, the Open Source Project 1

What’s Included 1

Source Code Repositories 2

How to Get Involved  5

Mailing Lists 7

Bug Tracking 8

Swift Evolution and Roadmap 12

Priorities for the Swift 4.0 Major Release 14

Binary Downloads  14

MacOS Binaries  15

Linux Binaries  16

Swiftenv, Swift Version Manager  17

Summary 17

2 A Swift Sandbox in the Cloud 19

The IBM Cloud Platform 19

Getting Started 26

Sign Me Up!.  26

Saving and Sharing Code Samples  28

Selecting Swift Versions and More  30

Have You Run on a Mainframe Lately? 30

IBM Swift Package Catalog and Sandbox 32

Summary 33

3 A Basic Introduction to Swift 35

Background 35

Let’s Get Coding!  35

Swift Standard Library 35

Swift Foundation Library 37

C Library Interoperability 39

Concurrency Library 41

Memory Management 43

The Language Landscape 48

Language Groupings 48

Language Timeline  50

Summary 51

4 The IBM Bluemix Buildpack for Swift 53

Cloud Foundry Buildpacks 53

Buildpack Phases  54

Working with the IBM Bluemix Buildpack for Swift 55

Where Is the Source Code Hosted?  55

What Version of the Buildpack Is Currently Installed?  56

File Artifacts Required for Provisioning Your Application on Bluemix 58

Installing Additional System-Level Dependencies 61

Downloading Closed Source Dependencies 68

Examples of Using the IBM Bluemix Buildpack for Swift  69

Swift HelloWorld  69

Kitura Starter  74

BluePic 77

Using the Latest Code of the IBM Bluemix Buildpack for Swift 87

Summary 88

5 Using Containers on Bluemix to Run Swift Code 91

What Are Docker Containers? 91

Docker Images for Swift 92

Installing Docker.  93

Using Docker as a Development Tool  94

Exposing Your Swift Application’s Port to the Host System 96

Using docker-compose 96

Why Use Containers on Bluemix? 98

Containers for Packaging and Deployment of Swift Applications  99

The Kubernetes Platform 99

Running Your Docker Image in the Bluemix Cloud 100

Install the Kubernetes Command Line 100

Install the Bluemix Command Line. 100

Install the IBM Container Registry Plug-In 102

Install the IBM Container Service Plug-In 102

Create a Runtime Image for Swift Applications 103

Tag a Docker Image 106

Push a Docker Image to Bluemix  107

Create a Kubernetes Cluster on Bluemix 108

High Availability in Kubernetes Clusters 112

Binding Bluemix Services to IBM Containers. 113

Summary 116

6 Swift Package Management 119

Swift Package Manager 119

Using Swift Package Manager  120

Commands  121

Package.Swift Details 123

Swift Package Catalog 123

Browsing 123

Searching 124

Package Details  126

Dependency Visualization 127

Trying Out a Package in the Sandbox 128

Summary 130

7 Swift and Kitura for Web Applications 131

Kitura 133

Sending Simple Responses to Requests 136

A Real-World Library Example  137

Accessing Information Sent in Requests 138

Starting the Library Application  140

Working with Various HTTP Features Using Kitura  149

Other Ways of Serving Content Using Kitura 155

Other Useful Kitura Middleware  157

Authentication Using the Kitura-Credentials Framework 159

The Library Sample with Authentication 160

Kitura and Data Access 163

Swift-Kuery  163

Kitura-redis  170

Summary 173

8 Serverless Programming with Swift 175

Microservices and Serverless Computing 175

Serverless Computing Concepts  177

OpenWhisk  179

Swift and OpenWhisk 182

Using the Web-Based OpenWhisk Tools 183

Command Line OpenWhisk 189

A More Involved Example 195

Summary 201

9 Over the Horizon: Where Do We Go from Here? 203

Bringing Swift to the Server 203

IBM Cloud Tools for Swift 204

Server-Side Frameworks 210

Expanding the Range of Swift 215

Swift Support for Linux 215

The Internet of Swift Things 215

Big Iron Swift  216

Swift DevOps 218

Summary 219

Index  221

loading