FrenchKit: End to End Application Development with Swift

Post on 08-Jan-2017

265 views 1 download

transcript

Swift @ IBM Engineering TeamChris Bailey(@Chris__Bailey)

September 23rd, 2016

End to End Application Development

Swift @ IBM

User-facing Client Apps

Modern Application Design

App Services

3rd Party Services

On Prem Services

End Users

Swift @ IBM

Modern Application Design

End Users User-facing Client Apps

App Services

On Prem Services

3rd Party Services

Swift @ IBM

Modern Application Design

End Users User-facing Client Apps

App Services

On Prem Services

3rd Party Services

Developer ExperienceIntegrated

Swift @ IBM

Why Swift on the Server?

Swift @ IBM

4.0

0.0

20.0

40.0

60.0

80.0

100.0

120.0

Performant Applications

http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=spectralnorm

Dur

atio

n (s

) (lo

wer

is b

ette

r)

Swift @ IBM

4.0 4.3

0.0

20.0

40.0

60.0

80.0

100.0

120.0

Performant Applications

http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=spectralnorm

Dur

atio

n (s

) (lo

wer

is b

ette

r)

Swift @ IBM

4.0 4.315.8

0.0

20.0

40.0

60.0

80.0

100.0

120.0

Performant Applications

http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=spectralnorm

Dur

atio

n (s

) (lo

wer

is b

ette

r)

Swift @ IBM

Performant Applications

http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=spectralnorm

4.0 4.315.8

134.2

0.0

20.0

40.0

60.0

80.0

100.0

120.0

Dur

atio

n (s

) (lo

wer

is b

ette

r)

Swift @ IBM

15.0

0.0

10.0

20.0

30.0

40.0

50.0

60.0

Low Memory

http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=spectralnorm

Mem

ory

Usa

ge (M

B)

(low

er is

bet

ter)

Swift @ IBM

15.0

32.2

0.0

10.0

20.0

30.0

40.0

50.0

60.0

Low Memory

http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=spectralnorm

Mem

ory

Usa

ge (M

B)

(low

er is

bet

ter)

Swift @ IBM

15.0

32.2

25.3

0.0

10.0

20.0

30.0

40.0

50.0

60.0

Low Memory

http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=spectralnorm

Mem

ory

Usa

ge (M

B)

(low

er is

bet

ter)

Swift @ IBM

15.0

32.2

25.3

54.6

0.0

10.0

20.0

30.0

40.0

50.0

60.0

Low Memory

http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=spectralnorm

Mem

ory

Usa

ge (M

B)

(low

er is

bet

ter)

Swift @ IBM

Swift is ideal for Cloud

Swift @ IBM

Isomorphic Development

Swift @ IBM

Create Swift Project

Isomorphic Development

Swift @ IBM

Create Swift Project

Deploy Deploy

Isomorphic Development

Swift @ IBM

Create Swift Project

Deploy DeployGenerate

Swagger APISpecification

•  Program in Swift on client and server

•  Share code on both sides

•  Automatically created Swagger APIs

Sharing tools and technologies

Swift @ IBM

How does this happen?

Swift @ IBM

Extend Swift to the server

Swift on the Server can attract Swift-based Developers

Swift @ IBM

December 3rd, 2015

Apache 2.0 Software Licence

Open Source Swift

Linux Platforms Darwin Platforms

Swift on Linux

Swift @ IBM

Swift

StandardLibrary Foundation Dispatch

Swift

StandardLibrary Foundation Dispatch

Consistent Runtime across Platforms

Add a Web Framework

Kitura: A Swift Web Framework and HTTP Server

http://kitura.ioSwift @ IBM

Server / Cloud Deployment Server / Cloud Deployment Apple Client Deployment

Client Facing App Client-Specific

Libraries

Kitura Web Framework

Swift @ IBM

Swift

StandardLibrary Foundation Dispatch

Swift

StandardLibrary Foundation Dispatch

Net

wor

king

Sec

urity

HTT

P P

arsi

ng

Application Libraries

Application Specific Cloud Services

Server-Specific Libraries

Consistent Runtime across Clients/Servers

Kitura-based Server !Built with Dispatch & Foundation

Application Libraries

Server / Cloud Deployment Server / Cloud Deployment Apple Client Deployment

Client Facing App Client-Specific

Libraries

Kitura Web Framework

Swift @ IBM

Swift

StandardLibrary Foundation Dispatch

Swift

StandardLibrary Foundation Dispatch

Net

wor

king

Sec

urity

HTT

P P

arsi

ng

Application Libraries

Application Specific Cloud Services

Server-Specific Libraries

Consistent Runtime across Clients/Servers

Kitura-based Server !Built with Dispatch & Foundation

Swift

“Server” APIs

Application Libraries

Swift on the Server is Real

Swift 3.0 + Kitura 1.0

Swift @ IBM

Let’s take a tour…

Swift @ IBM

Architecture

Web Framework Source

Swift Binary

Dispatch Foundation Package Manager

Swift Libraries

SwiftyJSON SwiftMongoDB

C Helpers & Interfaces

C Libraries

HttpParser HiRedis CURL PCRE2

Pluggable Components

Architecture

Web Framework Source

Swift Binary

Dispatch Foundation Package Manager

Swift Libraries

SwiftyJSON SwiftMongoDB

C Helpers & Interfaces

C Libraries

HttpParser HiRedis CURL PCRE2

Pluggable Components

Swift Libraries

Server APIs

Create an ApplicationFirst, create a new project directory

Next, create a new Swift project using the Swift Package Manager.

In Package.swift, add Kitura as a dependency for your project.

Create an ApplicationIn Sources/main.swift, add the following code.

Deploy an Application

Open your browser at http://localhost:8090

Compile and run your application:

Use Services

Deploy to Cloud

$ docker pull ibmcom/kitura-ubuntu:latest $ git clone https://github.com/IBM-Swift/Kitura-Starter-Bluemix

Using Cloud Tools

http://cloudtools.bluemix.net

• Deployment made easy

• Clone, code, push

• Demo projects to try

http://www.kitura.io/en/resources/tutorials.html

Tutorials• Creating a Todo-List Backend• Adding Authentication with Kitura-Credentials• Adding Sessions with Kitura-Session• Using Templating Engines with Kitura• Enabling SSL/TLS on Kitura• Using FastCGI with Kitura• Special Types of Response Handlers• Parsing Requests

Examples

Blitter Social Networkhttps://github.com/ibm-swift/blitter

BluePic Applicationhttps://github.com/ibm-swift/bluepic

Discover Try

Build

IBM Cloud Tools

Package Catalog Swift Sandbox

Kitura + Packages

DeploySwift @ IBM

Swift @ IBM

https://developer.ibm.com/swift/

Thank you!

Swift @ IBM