Slide 1

Slide 1 text

IBM & Server Side Swift Making Your Mobile Developers Full Stack By David Okun @dokun24

Slide 2

Slide 2 text

A Brief History of Swift @dokun24

Slide 3

Slide 3 text

A Brief History of Swift • June 2014 - Swift is released @dokun24

Slide 4

Slide 4 text

A Brief History of Swift • June 2014 - Swift is released • June 2015 - Swift on Linux is announced @dokun24

Slide 5

Slide 5 text

A Brief History of Swift • June 2014 - Swift is released • June 2015 - Swift on Linux is announced • December 2015 - swift.org goes live @dokun24

Slide 6

Slide 6 text

A Brief History of Swift • June 2014 - Swift is released • June 2015 - Swift on Linux is announced • December 2015 - swift.org goes live • March 2016 - First Linux build available @dokun24

Slide 7

Slide 7 text

A Brief History of Swift • June 2014 - Swift is released • June 2015 - Swift on Linux is announced • December 2015 - swift.org goes live • March 2016 - First Linux build available • June 2016 - Kitura at WWDC @dokun24

Slide 8

Slide 8 text

A Brief History of Swift • June 2014 - Swift is released • June 2015 - Swift on Linux is announced • December 2015 - swift.org goes live • March 2016 - First Linux build available • June 2016 - Kitura at WWDC • October 2017 - Kitura 2.0 @dokun24

Slide 9

Slide 9 text

Kitura - HTTP for Swift @dokun24

Slide 10

Slide 10 text

Kitura - HTTP for Swift • Architected like Express.js @dokun24

Slide 11

Slide 11 text

Kitura - HTTP for Swift • Architected like Express.js • Written with Swift on Linux @dokun24

Slide 12

Slide 12 text

Kitura - HTTP for Swift • Architected like Express.js • Written with Swift on Linux • Front-end templating @dokun24

Slide 13

Slide 13 text

Kitura - HTTP for Swift • Architected like Express.js • Written with Swift on Linux • Front-end templating • Persistence layer compatibility @dokun24

Slide 14

Slide 14 text

@dokun24

Slide 15

Slide 15 text

@dokun24

Slide 16

Slide 16 text

@dokun24

Slide 17

Slide 17 text

@dokun24

Slide 18

Slide 18 text

@dokun24

Slide 19

Slide 19 text

@dokun24

Slide 20

Slide 20 text

Kitura 2.0 @dokun24

Slide 21

Slide 21 text

Kitura 2.0 • KituraKit - for clients @dokun24

Slide 22

Slide 22 text

Kitura 2.0 • KituraKit - for clients • A shiny new CLI @dokun24

Slide 23

Slide 23 text

Kitura 2.0 • KituraKit - for clients • A shiny new CLI • Codable routing @dokun24

Slide 24

Slide 24 text

Codable? @dokun24

Slide 25

Slide 25 text

Codable? @dokun24

Slide 26

Slide 26 text

Kitura 1.x Parsing @dokun24

Slide 27

Slide 27 text

Kitura 1.x Parsing router.post("/animals") { request, response, next in defer { next() } guard let animalJSON = request["animal"] as? [String: AnyObject] else { response.send(json: JSON(["Error" : "Could not parse object"])) } let animal = Animal(json: animalJSON) if animal.save() { response.status(.ok).send(json: JSON(animalJSON)) } else { response.status(.badRequest) } } @dokun24

Slide 28

Slide 28 text

Kitura 1.x Parsing @dokun24

Slide 29

Slide 29 text

Kitura 1.x Parsing init? (json: [String: AnyObject]) { if let animalID = json[AnimalJSONConstants.id] as? Int, let photoURL = json[AnimalJSONConstants.photoURL] as? String, let looksFriendly = json[AnimalJSONConstants.looksFriendly] as? Bool, let plural = json[AnimalJSONConstants.plural] as? Bool, let typeString = json[AnimalJSONConstants.type] as? String { self.animalID = animalID self.photoURL = photoURL self.looksFriendly = looksFriendly self.plural = plural self.type = typeString == AnimalConstants.bear ? AnimalType.Bear : AnimalType.Cat } else { return nil } } @dokun24

Slide 30

Slide 30 text

Kitura 2.x Parsing @dokun24

Slide 31

Slide 31 text

Kitura 2.x Parsing @dokun24 router.post(“/animals”, handler: store) func store(animal: Animal, completion: (Animal?, RequestError?) -> Void) -> Void { if animal.save() { completion(animal, nil) } else { completion(nil, RequestError(httpCode: .400)) } }

Slide 32

Slide 32 text

Codable Protocol @dokun24

Slide 33

Slide 33 text

Codable Protocol • Responsible for encoding and decoding objects to another type, such as JSON @dokun24

Slide 34

Slide 34 text

Codable Protocol • Responsible for encoding and decoding objects to another type, such as JSON • Sub-protocols: Encodable and Decodable @dokun24

Slide 35

Slide 35 text

Codable Protocol • Responsible for encoding and decoding objects to another type, such as JSON • Sub-protocols: Encodable and Decodable • Forces an object to be ready-made for HTTP @dokun24

Slide 36

Slide 36 text

Kitura CLI @dokun24

Slide 37

Slide 37 text

Kitura CLI • Uses Yeoman to generate projects @dokun24

Slide 38

Slide 38 text

Kitura CLI • Uses Yeoman to generate projects • Ready made for IBM Cloud deployment @dokun24

Slide 39

Slide 39 text

Kitura CLI • Uses Yeoman to generate projects • Ready made for IBM Cloud deployment • Analytics, health, OpenAPI UI @dokun24

Slide 40

Slide 40 text

Kitura CLI @dokun24

Slide 41

Slide 41 text

Kitura CLI brew tap ibm-swift/kitura @dokun24

Slide 42

Slide 42 text

Kitura CLI brew tap ibm-swift/kitura brew install kitura @dokun24

Slide 43

Slide 43 text

Kitura CLI brew tap ibm-swift/kitura brew install kitura kitura init @dokun24

Slide 44

Slide 44 text

Kitura CLI @dokun24

Slide 45

Slide 45 text

Kitura CLI -rw-r--r-- 1 davidokunibm staff 992B Nov 6 13:26 Dockerfile -rw-r--r-- 1 davidokunibm staff 876B Nov 6 13:26 Dockerfile-tools drwxr-xr-x 37 davidokunibm staff 1.2K Nov 6 13:47 Application.xcodeproj -rw-r--r-- 1 davidokunibm staff 1.1K Nov 6 13:26 LICENSE -rw-r--r-- 1 davidokunibm staff 5.4K Nov 6 13:26 Package.resolved -rw-r--r-- 1 davidokunibm staff 1.1K Nov 6 13:26 Package.swift -rw-r--r-- 1 davidokunibm staff 6.7K Nov 6 13:26 README.md drwxr-xr-x 4 davidokunibm staff 136B Nov 6 13:26 Sources drwxr-xr-x 4 davidokunibm staff 136B Nov 6 13:26 Tests drwxr-xr-x 3 davidokunibm staff 102B Nov 6 13:26 chart -rw-r--r-- 1 davidokunibm staff 2.0K Nov 6 13:26 cli-config.yml -rw-r--r-- 1 davidokunibm staff 154B Nov 6 13:26 manifest.yml drwxr-xr-x 7 davidokunibm staff 238B Nov 6 14:28 public -rw-r--r-- 1 davidokunibm staff 110B Nov 6 13:26 spec.json @dokun24

Slide 46

Slide 46 text

Kitura CLI @dokun24

Slide 47

Slide 47 text

Kitura CLI kitura create // interactively create a project @dokun24

Slide 48

Slide 48 text

Kitura CLI kitura create // interactively create a project kitura kit // download the KituraKit zip file @dokun24

Slide 49

Slide 49 text

Kitura CLI kitura create // interactively create a project kitura kit // download the KituraKit zip file kitura idt // install IBM Cloud Developer Tools @dokun24

Slide 50

Slide 50 text

Kitura CLI kitura create // interactively create a project kitura kit // download the KituraKit zip file kitura idt // install IBM Cloud Developer Tools kitura build // build the project in a local container @dokun24

Slide 51

Slide 51 text

Kitura CLI kitura create // interactively create a project kitura kit // download the KituraKit zip file kitura idt // install IBM Cloud Developer Tools kitura build // build the project in a local container kitura run // run the project in a local container @dokun24

Slide 52

Slide 52 text

Kitura Demo @dokun24

Slide 53

Slide 53 text

Resources @dokun24

Slide 54

Slide 54 text

Resources • http://kitura.io @dokun24

Slide 55

Slide 55 text

Resources • http://kitura.io • https://developer.ibm.com/swift/ @dokun24

Slide 56

Slide 56 text

Resources • http://kitura.io • https://developer.ibm.com/swift/ • https://github.com/ibm/foodtrackerbackend @dokun24

Slide 57

Slide 57 text

Thanks! @dokun24