Swift in the Cloud

  • ID: 3973398
  • Book
  • 264 Pages
  • John Wiley and Sons Ltd
1 of 4
Your one–stop guide to creating and running Swift applications in the cloud

Since its introduction in 2014, the Swift language has become one of the most rapidly adopted programming languages in history. In Swift in the Cloud, the team responsible for bringing Swift to the cloud environment walks you through every step needed to create code that runs in massively scalable cloud environments. You will learn both the concepts involved and examples of real code you can start using today.

These experts introduce you to the Swift language and its features as well as the elements and structure of the Swift.org open technology project. From there, you will learn to create server applications that run on the pay–as–you–go cloud infrastructure, how to write and test Swift code snippets in your own cloud sandbox, and how to use the Cloud Foundry Buildpack for Swift to avoid the complexities of runtime configuration. You will be able to build high–performing web applications and REST APIs with a Swift–based web server framework and run Swift modules in an asynchronous, open source, "serverless" cloud environment. Swift enables you to build all components of a scalable, robust business software solution using the same programming language.

Swift in the Cloud introduces you to:

- IBM's Cloud Platform–as–a–Service environment - Using Docker containers to run Swift - Swift packages and the Package Manager - Using Swift and Kitura for web applications - Event–driven programming using OpenWhisk - Plenty of examples and code samples you can use now
Note: Product cover images may vary from those shown
2 of 4

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

Note: Product cover images may vary from those shown
3 of 4

Loading
LOADING...

4 of 4
Leigh Williamson
John Ponzo
Patrick Bohrer
Ricardo Olivieri
Karl Weinmeister
Samuel Kallner
Note: Product cover images may vary from those shown
5 of 4
Note: Product cover images may vary from those shown
Adroll
adroll