|
Swift™ in the Cloud |
3 |
|
|
About the Authors |
9 |
|
|
About the Technical Editor |
11 |
|
|
Credits |
13 |
|
|
Acknowledgments |
15 |
|
|
Contents at a Glance |
17 |
|
|
Contents |
19 |
|
|
Introduction |
25 |
|
|
1 Swift.org, the Open Source Project |
37 |
|
|
What’s Included |
37 |
|
|
Source Code Repositories |
38 |
|
|
How to Get Involved |
41 |
|
|
Mailing Lists |
43 |
|
|
Bug Tracking |
44 |
|
|
Swift Evolution and Roadmap |
48 |
|
|
Priorities for the Swift 4.0 Major Release |
50 |
|
|
Binary Downloads |
50 |
|
|
MacOS Binaries |
51 |
|
|
Linux Binaries |
52 |
|
|
Swiftenv, Swift Version Manager |
53 |
|
|
Summary |
53 |
|
|
2 A Swift Sandbox in the Cloud |
55 |
|
|
The IBM Cloud Platform |
55 |
|
|
Getting Started |
62 |
|
|
Sign Me Up! |
62 |
|
|
Saving and Sharing Code Samples |
64 |
|
|
Selecting Swift Versions and More |
66 |
|
|
Have You Run on a Mainframe Lately? |
66 |
|
|
IBM Swift Package Catalog and Sandbox |
68 |
|
|
Summary |
69 |
|
|
3 A Basic Introduction to Swift |
71 |
|
|
Background |
71 |
|
|
Let’s Get Coding! |
71 |
|
|
Swift Standard Library |
71 |
|
|
Swift Foundation Library |
73 |
|
|
C Library Interoperability |
75 |
|
|
Concurrency Library |
77 |
|
|
Memory Management |
79 |
|
|
The Language Landscape |
84 |
|
|
Language Groupings |
84 |
|
|
Language Timeline |
86 |
|
|
Summary |
87 |
|
|
4 The IBM Bluemix Buildpack for Swift |
89 |
|
|
Cloud Foundry Buildpacks |
89 |
|
|
Buildpack Phases |
90 |
|
|
Working with the IBM Bluemix Buildpack for Swift |
91 |
|
|
Where Is the Source Code Hosted? |
91 |
|
|
What Version of the Buildpack Is Currently Installed? |
92 |
|
|
File Artifacts Required for Provisioning Your Application on Bluemix |
94 |
|
|
Installing Additional System-Level Dependencies |
97 |
|
|
Downloading Closed Source Dependencies |
104 |
|
|
Examples of Using the IBM Bluemix Buildpack for Swift |
105 |
|
|
Swift HelloWorld |
105 |
|
|
Kitura Starter |
110 |
|
|
BluePic |
113 |
|
|
Using the Latest Code of the IBM Bluemix Buildpack for Swift |
123 |
|
|
Summary |
124 |
|
|
5 Using Containers on Bluemix to Run Swift Code |
127 |
|
|
What Are Docker Containers? |
127 |
|
|
Docker Images for Swift |
128 |
|
|
Installing Docker |
129 |
|
|
Using Docker as a Development Tool |
130 |
|
|
Exposing Your Swift Application’s Port to the Host System |
132 |
|
|
Using docker-compose |
132 |
|
|
Why Use Containers on Bluemix? |
134 |
|
|
Containers for Packaging and Deployment of Swift Applications |
135 |
|
|
The Kubernetes Platform |
135 |
|
|
Running Your Docker Image in the Bluemix Cloud |
136 |
|
|
Install the Kubernetes Command Line |
136 |
|
|
Install the Bluemix Command Line |
136 |
|
|
Install the IBM Container Registry Plug-In |
138 |
|
|
Install the IBM Container Service Plug-In |
138 |
|
|
Create a Runtime Image for Swift Applications |
139 |
|
|
Tag a Docker Image |
142 |
|
|
Push a Docker Image to Bluemix |
143 |
|
|
Create a Kubernetes Cluster on Bluemix |
144 |
|
|
High Availability in Kubernetes Clusters |
148 |
|
|
Binding Bluemix Services to IBM Containers |
149 |
|
|
Summary |
152 |
|
|
6 Swift Package Management |
155 |
|
|
Swift Package Manager |
155 |
|
|
Using Swift Package Manager |
156 |
|
|
Commands |
157 |
|
|
Package.Swift Details |
159 |
|
|
Swift Package Catalog |
159 |
|
|
Browsing |
159 |
|
|
Searching |
160 |
|
|
Package Details |
162 |
|
|
Dependency Visualization |
163 |
|
|
Trying Out a Package in the Sandbox |
164 |
|
|
Summary |
166 |
|
|
7 Swift and Kitura for Web Applications |
167 |
|
|
Kitura |
169 |
|
|
Sending Simple Responses to Requests |
172 |
|
|
A Real-World Library Example |
173 |
|
|
Accessing Information Sent in Requests |
174 |
|
|
Starting the Library Application |
176 |
|
|
Working with Various HTTP Features Using Kitura |
185 |
|
|
Other Ways of Serving Content Using Kitura |
191 |
|
|
Other Useful Kitura Middleware |
193 |
|
|
Authentication Using the Kitura-Credentials Framework |
195 |
|
|
The Library Sample with Authentication |
196 |
|
|
Kitura and Data Access |
199 |
|
|
Swift-Kuery |
199 |
|
|
Kitura-redis |
206 |
|
|
Summary |
209 |
|
|
8 Serverless Programming with Swift |
211 |
|
|
Microservices and Serverless Computing |
211 |
|
|
Serverless Computing Concepts |
213 |
|
|
OpenWhisk |
215 |
|
|
Swift and OpenWhisk |
218 |
|
|
Using the Web-Based OpenWhisk Tools |
219 |
|
|
Command Line OpenWhisk |
225 |
|
|
A More Involved Example |
231 |
|
|
Summary |
237 |
|
|
9 Over the Horizon: Where Do We Go from Here? |
239 |
|
|
Bringing Swift to the Server |
239 |
|
|
IBM Cloud Tools for Swift |
240 |
|
|
Server-Side Frameworks |
246 |
|
|
Expanding the Range of Swift |
251 |
|
|
Swift Support for Linux |
251 |
|
|
The Internet of Swift Things |
251 |
|
|
Big Iron Swift |
252 |
|
|
Swift DevOps |
254 |
|
|
Summary |
255 |
|
|
Index |
257 |
|
|
EULA |
267 |
|