Slide 1

Slide 1 text

BFFs For Swift Tim Condon @0xTim

Slide 2

Slide 2 text

BFFs For Swift @0xTim The Backend Problem General Purpose API Web Client

Slide 3

Slide 3 text

BFFs For Swift @0xTim The Backend Problem General Purpose API Web Client iOS App Android App

Slide 4

Slide 4 text

BFFs For Swift @0xTim The Backend Problem General Purpose API Web Client iOS App Android App Mobile Web Client TV Client

Slide 5

Slide 5 text

BFFs For Swift @0xTim The Backend Problem General Purpose API Web Client iOS App Android App Mobile Web Client 3rd Party Service 3rd Party Service TV Client

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

BFFs For Swift @0xTim The Backend Problem iOS App Monolith

Slide 8

Slide 8 text

BFFs For Swift @0xTim The Backend Problem iOS App Monolith Microservice

Slide 9

Slide 9 text

BFFs For Swift @0xTim The Backend Problem iOS App Microservice Microservice Microservice Microservice Microservice

Slide 10

Slide 10 text

BFFs For Swift @0xTim The Backend Problem iOS App Microservice Google API AWS API Microservice Microservice Microservice Microservice

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

BFFs For Swift @0xTim The Homescreen Problem Events Location Schedule Speakers

Slide 13

Slide 13 text

BFFs For Swift @0xTim The Homescreen Problem Events Location Schedule Speakers GET /api/events/coming-up { "page": { "totalPages": 11, "nextPage": "/api/events/coming-up?page=2&count=100" }, "events": [ { "id": "5212187e-e431-46eb-aebd-be0fccd9a2fb", "name": "dotSwift", "start": "2020-02-03T09:30:00+01:00", "end": "2020-02-03T18:30:00+01:00", "speakers": [ "e6adf697-4c6b-48e8-b5c0-27a0b305ce09", ... "fb9989a4-97b3-472e-93b5-efaf8d207dfe" ], "emcee": "9ef5e988-18cd-438b-a61b-7334986c67ec", "location": { "latitude": 48.878765, "longitude": 2.330944, "id": "a1a02cd0-2a94-425d-bd04-c2d054ce254a" } } ], ... }

Slide 14

Slide 14 text

BFFs For Swift @0xTim The Homescreen Problem Events Location Schedule Speakers GET /api/locations/a1a02cd0-2a94-425d-bd04-c2d054ce254a { "latitude": 48.878765, "longitude" 2.330944, "name": "Théâtre de Paris", "address": "15 Rue Blanche, 75009 Paris", "nearest-stations": [ { "line": "Green 12", "name": "Trinité" }, ... ] ... }

Slide 15

Slide 15 text

BFFs For Swift @0xTim The Homescreen Problem Events Location Schedule Speakers GET /api/events/5212187e-e431-46eb-aebd-be0fccd9a2fb/schedule { "talks": [ ... { "title": "BFFs For Swift", "speaker": "e6adf697-4c6b-48e8-b5c0-27a0b305ce09", "start-time": "2020-02-03T14:30:00+01:00", "end-time": "2020-02-03T14:50:00+01:00", "room": "f5536b5a-223b-4a1a-b050-836bd4e924fa" }, { "title": "Property Wrappers or How Swift decided to become Java", "speaker": "fb9989a4-97b3-472e-93b5-efaf8d207dfe", "start-time": "2020-02-03T15:30:00+01:00", "end-time": "2020-02-03T15:50:00+01:00", "room": "9a1a7f2d-230e-40e0-8757-dc80ec4aa25d" }, ... ], "breaks": { ... } }

Slide 16

Slide 16 text

BFFs For Swift @0xTim The Homescreen Problem Events Location Schedule Speakers GET /api/speakers/e6adf697-4c6b-48e8-b5c0-27a0b305ce09/ { "name": "Tim Condon", "profile-image": "https://s3-eu-central-1.amazonaws.com/ static-dotconferences-com/speakers_images/tim-condon.png", "talk": "c3d5735e-f8a3-4ca4-94c7-802c8f4306db", "bio": "Tim is the server-side Swift team lead at raywenderlich.com and has written the unofficial-official book on Vapor with the founders of the framework. He founded Broken Hands and delivers talks and workshops on Vapor and server-side Swift around the world. He also co-organises the ServerSide.swift conference.", "github": "0xTim", "twitter": "0xTim" }

Slide 17

Slide 17 text

BFFs For Swift @0xTim The Homescreen Problem Events Location Schedule Speakers GET /api/events/coming-up { "page": { "totalPages": 11, "nextPage": "/api/events/coming-up?page=2&count=10" }, "events": [ { "name": "dotSwift", "date": "2020-02-03T00:00:00+01:00", "location": { "name": "Théâtre de Paris", "address": "15 Rue Blanche, 75009 Paris", }, "onNow": { "title": "BFFs For Swift", "startTime": "2020-02-03T14:30:00+01:00", "endTime": "2020-02-03T14:50:00+01:00", "speakerName": "Tim Condon" } } ], ... }

Slide 18

Slide 18 text

BFFs For Swift @0xTim The Homescreen Problem Events Location Schedule Speakers

Slide 19

Slide 19 text

BFFs For Swift @0xTim The Homescreen Problem Events Location Schedule Speakers iOS Team API Team

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

BFFs For Swift @0xTim The Homescreen Problem Events Location Schedule Speakers

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Backend For Frontend

Slide 24

Slide 24 text

BFFs For Swift @0xTim BFFs To The Rescue iOS App General Purpose API Weather API AWS Microservice Microservice

Slide 25

Slide 25 text

BFFs For Swift @0xTim BFF BFFs To The Rescue iOS App General Purpose API Weather API AWS Microservice Microservice

Slide 26

Slide 26 text

BFFs For Swift @0xTim BFFs To The Rescue BFF iOS App GET /api/events/coming-up { "page": { "totalPages": 11, "nextPage": "/api/events/coming-up?page=2&count=10" }, "events": [ { "name": "dotSwift", "date": "2020-02-03T00:00:00+01:00", "location": { "name": "Théâtre de Paris", "address": "15 Rue Blanche, 75009 Paris", }, "onNow": { "title": "BFFs For Swift", "startTime": "2020-02-03T14:30:00+01:00", "endTime": "2020-02-03T14:50:00+01:00", "speakerName": "Tim Condon" } } ], ... }

Slide 27

Slide 27 text

BFFs For Swift @0xTim BFF Ownership iOS App AWS API iOS BFF Microservice Microservice Microservice Android BFF Web BFF Android App Website Client

Slide 28

Slide 28 text

BFFs For Swift @0xTim BFF Ownership iOS App AWS API iOS BFF Microservice Microservice Microservice Android BFF Web BFF Android App Website Client API Team iOS Team Android Team Web Team

Slide 29

Slide 29 text

– Sam Newman, Thoughtworks “The BFF is tightly coupled to a specific user experience, and will typically be maintained by the same team as the user interface, thereby making it easier to define and adapt the API as the UI requires, while also simplifying process of lining up release of both the client and server components.”

Slide 30

Slide 30 text

BFFs For Swift @0xTim BFF Examples

Slide 31

Slide 31 text

BFFs in Swift

Slide 32

Slide 32 text

BFFs For Swift @0xTim Swift on the Server

Slide 33

Slide 33 text

BFFs For Swift @0xTim Is it ready for production?

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

BFFs For Swift @0xTim Swift in BFFs

Slide 36

Slide 36 text

BFFs For Swift @0xTim Sharing Code

Slide 37

Slide 37 text

BFFs For Swift @0xTim Sharing Code BFF Models Package BFF

Slide 38

Slide 38 text

BFFs For Swift @0xTim GET /api/events/coming-up { "page": { "totalPages": 11, "nextPage": "/api/events/coming-up?page=2&count=10" }, "events": [ { "name": "dotSwift", "date": "2020-02-03T00:00:00+01:00", "location": { "name": "Théâtre de Paris", "address": "15 Rue Blanche, 75009 Paris", }, "on-now": { “title": "BFFs For Swift", "startTime": "2020-02-03T14:30:00+01:00", "endTime": "2020-02-03T14:50:00+01:00", "speakerName": "Tim Condon" } } ], ... } struct ComingUpResponse: Codable { let page: PaginationInformation let events: [ComingUpEvent] } struct PaginationInformation: Codable { let totalPages: Int let nextPage: URL } Sharing Code

Slide 39

Slide 39 text

BFFs For Swift @0xTim Sharing Code GET /api/events/coming-up { "page": { "totalPages": 11, "nextPage": "/api/events/coming-up?page=2&count=10" }, "events": [ { "name": "dotSwift", "date": "2020-02-03T00:00:00+01:00", "location": { "name": "Théâtre de Paris", "address": "15 Rue Blanche, 75009 Paris", }, "on-now": { “title": "BFFs For Swift", "startTime": "2020-02-03T14:30:00+01:00", "endTime": "2020-02-03T14:50:00+01:00", "speakerName": "Tim Condon" } } ], ... } struct ComingUpEvent: Codable { let name: String let date: Date let location: ComingUpLocation let onNowInfo: ComingUpOnNowInfo } struct ComingUpLocation: Codable { let name: String let address: String } struct ComingUpOnNowInfo: Codable { let title: String let startTime: Date let endTime: Date let speakerName: String }

Slide 40

Slide 40 text

BFFs For Swift

Slide 41

Slide 41 text

Thank you! @0xTim