Backend-driven UIs - #Pragma Conference 2016

John Sundell
John SundelliOS Developer, Open Source Contributor & Speaker at Sundell & Co
@JOHNSUNDELL
BACKEND-DRIVEN UIS
John Sundell
Lead iOS Developer, Spotify
! "
! "#
CocoaPods/Carthage
Fastlane
Swift
Protocol oriented programming
Model-View-ViewModel
Promises / Operations / Rx
UI
Backend-driven UIs - #Pragma Conference 2016
// MARK: - UITableViewDataSource
func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return model.unreadMessages.count
}
return model.readMessages.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "message", for: indexPath)
let message: Message
if indexPath.section == 0 {
message = model.unreadMessages[indexPath.row]
} else {
message = model.readMessages[indexPath.row]
}
cell.textLabel?.text = message.subject
cell.detailTextLabel?.text = "From: (message.sender)"
return cell
}
UITableViewDelegate
UITableViewDataSource
Caching
UIViewController subclass
JSON parsing
Integrate view controller with
the rest of the app
Setup UITableView
Register UITableViewCell class
UITableViewCell subclass
Handle network errors
Handle slow connections
Offline
Perform HTTP request
View Model
City Model
BACKEND
Backend-driven UIs - #Pragma Conference 2016
Backend-driven UIs - #Pragma Conference 2016
Backend response
[
Image(“Tokyo”),
Image(“Gothenburg”),
Row(“Berlin”, “Germany”),
Row(“Beijing”, “China”),
Row(“Paris”, “France”),
Row(“San Francisco”, “USA”),
User(“Julia”),
User(“Mathew”),
User(“Caroline”),
User(“David”),
Row(“Athens”, “Greece”),
Row(“Oslo”, “Norway”),
Row(“Stockholm”, “Sweden”)
]
Backend-driven UIs - #Pragma Conference 2016
1. SHARED DATA MODEL
(FULLY SERIALIZABLE)
struct Image {
var url: URL
}
struct City {
var name: String
var country: String
}struct User {
var name: String
var imageUrl: URL
}
ComponentModel
ComponentModel
ComponentModel
ViewModel
struct {
var title: String
var subtitle: String
var imageUrl: URL
...
}
ComponentModel
2. PROTOCOL-ORIENTED VIEWS
Components
UICollectionView
Components
UICollectionView
protocol Component {
var view: UIView? { get }
func loadView()
}
func configure(withModel: ComponentModel)
var preferredViewSize: CGSize { get }
var layoutTraits: [LayoutTrait] { get }
UICollectionViewLayout
3. A DECLARATIVE API
class ViewController: UIViewController {
init(json: Data)
}
class ViewController: UIViewController {
init(json: Data)
}
$
Reloads Actions Local dataInteractions
ContentOperationsViewModelBuilder Content
BACKEND
LOCAL CODE
1. SHARED DATA MODEL
2. PROTOCOL-ORIENTED VIEWS
3. A DECLARATIVE API
Backend-driven UIs - #Pragma Conference 2016
DEMO
OPEN SOURCE! %
GITHUB.COM/JOHNSUNDELL
@JOHNSUNDELL
1 of 27

Recommended

2. 엔티티 매핑(entity mapping) 2 2 엔티티매핑 2-2-4. 식별자 자동 생성(@generated-value) part2 by
2. 엔티티 매핑(entity mapping) 2 2 엔티티매핑 2-2-4. 식별자 자동 생성(@generated-value) part22. 엔티티 매핑(entity mapping) 2 2 엔티티매핑 2-2-4. 식별자 자동 생성(@generated-value) part2
2. 엔티티 매핑(entity mapping) 2 2 엔티티매핑 2-2-4. 식별자 자동 생성(@generated-value) part2탑크리에듀(구로디지털단지역3번출구 2분거리)
1K views10 slides
Understanding form helpers by
Understanding form helpersUnderstanding form helpers
Understanding form helpersBruno Almeida
147 views21 slides
Registerable views (Cocoaheads May 2018 Lyon) by
Registerable views (Cocoaheads May 2018 Lyon)Registerable views (Cocoaheads May 2018 Lyon)
Registerable views (Cocoaheads May 2018 Lyon)Pierre Felgines
5.2K views25 slides
e computer notes - Advanced subqueries by
e computer notes - Advanced subqueriese computer notes - Advanced subqueries
e computer notes - Advanced subqueriesecomputernotes
874 views26 slides
Screenshot list of Workflow by
Screenshot list of Workflow Screenshot list of Workflow
Screenshot list of Workflow Raonak Islam Niloy
45 views35 slides
Settings API - Oslo WordPress Meetup - November 22, 2011 by
Settings API - Oslo WordPress Meetup - November 22, 2011Settings API - Oslo WordPress Meetup - November 22, 2011
Settings API - Oslo WordPress Meetup - November 22, 2011WPOslo
281 views7 slides

More Related Content

Viewers also liked

Dynamic, native, backend-driven UIs - App Builders 2016 by
Dynamic, native, backend-driven UIs - App Builders 2016Dynamic, native, backend-driven UIs - App Builders 2016
Dynamic, native, backend-driven UIs - App Builders 2016John Sundell
2.8K views27 slides
Component-driven UIs - Mobile Era 2016 by
Component-driven UIs - Mobile Era 2016Component-driven UIs - Mobile Era 2016
Component-driven UIs - Mobile Era 2016John Sundell
872 views27 slides
save girl child... by
save girl child...save girl child...
save girl child...Alfaz Malkani
533 views21 slides
Why I Walk by
Why I WalkWhy I Walk
Why I WalkRobert Stribley
13.3K views43 slides
How does Content go Viral? by
How does Content go Viral?How does Content go Viral?
How does Content go Viral?Daniel Howard
691 views72 slides
Grow with HubSpot - Tokyo - September 2016 by
Grow with HubSpot - Tokyo - September 2016Grow with HubSpot - Tokyo - September 2016
Grow with HubSpot - Tokyo - September 2016Ryan Bonnici
728 views251 slides

Viewers also liked(20)

Dynamic, native, backend-driven UIs - App Builders 2016 by John Sundell
Dynamic, native, backend-driven UIs - App Builders 2016Dynamic, native, backend-driven UIs - App Builders 2016
Dynamic, native, backend-driven UIs - App Builders 2016
John Sundell2.8K views
Component-driven UIs - Mobile Era 2016 by John Sundell
Component-driven UIs - Mobile Era 2016Component-driven UIs - Mobile Era 2016
Component-driven UIs - Mobile Era 2016
John Sundell872 views
How does Content go Viral? by Daniel Howard
How does Content go Viral?How does Content go Viral?
How does Content go Viral?
Daniel Howard691 views
Grow with HubSpot - Tokyo - September 2016 by Ryan Bonnici
Grow with HubSpot - Tokyo - September 2016Grow with HubSpot - Tokyo - September 2016
Grow with HubSpot - Tokyo - September 2016
Ryan Bonnici728 views
Inventory slide share by Sarah Pilling
Inventory slide share Inventory slide share
Inventory slide share
Sarah Pilling748 views
Adversarial to Harmonious: Building the Developer / UX Connection by Nick Tucker
Adversarial to Harmonious: Building the Developer / UX ConnectionAdversarial to Harmonious: Building the Developer / UX Connection
Adversarial to Harmonious: Building the Developer / UX Connection
Nick Tucker584 views
Working with a super model for SharePoint Tuga IT 2016 by Sonja Madsen
Working with a super model for SharePoint Tuga IT 2016Working with a super model for SharePoint Tuga IT 2016
Working with a super model for SharePoint Tuga IT 2016
Sonja Madsen746 views
Hesham_Marei_portfolio2 by Hesham Marei
Hesham_Marei_portfolio2Hesham_Marei_portfolio2
Hesham_Marei_portfolio2
Hesham Marei396 views
Times of India TOI- Art of a kind- Popart -2010 by archana jhangiani
Times of India TOI- Art of a kind- Popart -2010Times of India TOI- Art of a kind- Popart -2010
Times of India TOI- Art of a kind- Popart -2010
archana jhangiani306 views
Dietary Guidelines for America by the Numbers Infographic by Food Insight
Dietary Guidelines for America by the Numbers InfographicDietary Guidelines for America by the Numbers Infographic
Dietary Guidelines for America by the Numbers Infographic
Food Insight4.6K views
Last Minute Gift Guide by Lloyd Douaihy
Last Minute Gift GuideLast Minute Gift Guide
Last Minute Gift Guide
Lloyd Douaihy1.2K views
Customer Acquisition: Growth marketing for startups by Chris Schultz
Customer Acquisition: Growth marketing for startupsCustomer Acquisition: Growth marketing for startups
Customer Acquisition: Growth marketing for startups
Chris Schultz11.5K views
Reinventing Mass Media with 10,000 Little Jon Stewarts by WebVisions
Reinventing Mass Media with 10,000 Little Jon StewartsReinventing Mass Media with 10,000 Little Jon Stewarts
Reinventing Mass Media with 10,000 Little Jon Stewarts
WebVisions707 views
The Inner Creative by Gerry Baird
The Inner CreativeThe Inner Creative
The Inner Creative
Gerry Baird263 views
20120119_For 2012 MezzoMedia Rookie by Sanghoon Lee
20120119_For 2012 MezzoMedia Rookie20120119_For 2012 MezzoMedia Rookie
20120119_For 2012 MezzoMedia Rookie
Sanghoon Lee2.3K views
Participative Design of qMOOCs with Deep Learning and 3d Virtual Immersive En... by Dr Stylianos Mystakidis
Participative Design of qMOOCs with Deep Learning and 3d Virtual Immersive En...Participative Design of qMOOCs with Deep Learning and 3d Virtual Immersive En...
Participative Design of qMOOCs with Deep Learning and 3d Virtual Immersive En...

Similar to Backend-driven UIs - #Pragma Conference 2016

How to become an Android dev starting from iOS (and vice versa) by
How to become an Android dev starting from iOS (and vice versa)How to become an Android dev starting from iOS (and vice versa)
How to become an Android dev starting from iOS (and vice versa)Giuseppe Filograno
59 views31 slides
Protocol Oriented MVVM - Auckland iOS Meetup by
Protocol Oriented MVVM - Auckland iOS MeetupProtocol Oriented MVVM - Auckland iOS Meetup
Protocol Oriented MVVM - Auckland iOS MeetupNatasha Murashev
2.2K views56 slides
Jsf intro by
Jsf introJsf intro
Jsf introvantinhkhuc
918 views50 slides
Introduction to Handoff by
Introduction to HandoffIntroduction to Handoff
Introduction to HandoffHarit Kothari
674 views23 slides
Swift勉強会第3回 〜UIを作ろう②〜 by
Swift勉強会第3回 〜UIを作ろう②〜Swift勉強会第3回 〜UIを作ろう②〜
Swift勉強会第3回 〜UIを作ろう②〜真次郎 新納
25 views15 slides
Protocol-Oriented MVVM (extended edition) by
Protocol-Oriented MVVM (extended edition)Protocol-Oriented MVVM (extended edition)
Protocol-Oriented MVVM (extended edition)Natasha Murashev
5.2K views55 slides

Similar to Backend-driven UIs - #Pragma Conference 2016(20)

How to become an Android dev starting from iOS (and vice versa) by Giuseppe Filograno
How to become an Android dev starting from iOS (and vice versa)How to become an Android dev starting from iOS (and vice versa)
How to become an Android dev starting from iOS (and vice versa)
Protocol Oriented MVVM - Auckland iOS Meetup by Natasha Murashev
Protocol Oriented MVVM - Auckland iOS MeetupProtocol Oriented MVVM - Auckland iOS Meetup
Protocol Oriented MVVM - Auckland iOS Meetup
Natasha Murashev2.2K views
Swift勉強会第3回 〜UIを作ろう②〜 by 真次郎 新納
Swift勉強会第3回 〜UIを作ろう②〜Swift勉強会第3回 〜UIを作ろう②〜
Swift勉強会第3回 〜UIを作ろう②〜
真次郎 新納25 views
Protocol-Oriented MVVM (extended edition) by Natasha Murashev
Protocol-Oriented MVVM (extended edition)Protocol-Oriented MVVM (extended edition)
Protocol-Oriented MVVM (extended edition)
Natasha Murashev5.2K views
Writing HTML5 Web Apps using Backbone.js and GAE by Ron Reiter
Writing HTML5 Web Apps using Backbone.js and GAEWriting HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAE
Ron Reiter12.2K views
Adopting 3D Touch in your apps by Juan C Catalan
Adopting 3D Touch in your appsAdopting 3D Touch in your apps
Adopting 3D Touch in your apps
Juan C Catalan241 views
Building Modern Apps using Android Architecture Components by Hassan Abid
Building Modern Apps using Android Architecture ComponentsBuilding Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture Components
Hassan Abid716 views
Asp.NET MVC by vrluckyin
Asp.NET MVCAsp.NET MVC
Asp.NET MVC
vrluckyin436 views
07_UIAndroid.pdf by ImranS18
07_UIAndroid.pdf07_UIAndroid.pdf
07_UIAndroid.pdf
ImranS182 views
How to build to do app using vue composition api and vuex 4 with typescript by Katy Slemon
How to build to do app using vue composition api and vuex 4 with typescriptHow to build to do app using vue composition api and vuex 4 with typescript
How to build to do app using vue composition api and vuex 4 with typescript
Katy Slemon73 views
What's New in Android by Robert Cooper
What's New in AndroidWhat's New in Android
What's New in Android
Robert Cooper1.5K views
Optimize CollectionView Scrolling by Andrea Prearo
Optimize CollectionView ScrollingOptimize CollectionView Scrolling
Optimize CollectionView Scrolling
Andrea Prearo1K views
Advanced Swift Generics by Max Sokolov
Advanced Swift GenericsAdvanced Swift Generics
Advanced Swift Generics
Max Sokolov2K views

Recently uploaded

Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITShapeBlue
208 views8 slides
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... by
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...ShapeBlue
129 views10 slides
Generative AI: Shifting the AI Landscape by
Generative AI: Shifting the AI LandscapeGenerative AI: Shifting the AI Landscape
Generative AI: Shifting the AI LandscapeDeakin University
67 views55 slides
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueShapeBlue
224 views7 slides
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... by
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...ShapeBlue
141 views29 slides
"Running students' code in isolation. The hard way", Yurii Holiuk by
"Running students' code in isolation. The hard way", Yurii Holiuk "Running students' code in isolation. The hard way", Yurii Holiuk
"Running students' code in isolation. The hard way", Yurii Holiuk Fwdays
36 views34 slides

Recently uploaded(20)

Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue208 views
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... by ShapeBlue
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
ShapeBlue129 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue224 views
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... by ShapeBlue
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
ShapeBlue141 views
"Running students' code in isolation. The hard way", Yurii Holiuk by Fwdays
"Running students' code in isolation. The hard way", Yurii Holiuk "Running students' code in isolation. The hard way", Yurii Holiuk
"Running students' code in isolation. The hard way", Yurii Holiuk
Fwdays36 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue207 views
The Role of Patterns in the Era of Large Language Models by Yunyao Li
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language Models
Yunyao Li91 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue199 views
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash162 views
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online by ShapeBlue
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online
ShapeBlue225 views
"Package management in monorepos", Zoltan Kochan by Fwdays
"Package management in monorepos", Zoltan Kochan"Package management in monorepos", Zoltan Kochan
"Package management in monorepos", Zoltan Kochan
Fwdays34 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu437 views
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue265 views
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue247 views
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023 by BookNet Canada
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
BookNet Canada44 views
Optimizing Communication to Optimize Human Behavior - LCBM by Yaman Kumar
Optimizing Communication to Optimize Human Behavior - LCBMOptimizing Communication to Optimize Human Behavior - LCBM
Optimizing Communication to Optimize Human Behavior - LCBM
Yaman Kumar38 views

Backend-driven UIs - #Pragma Conference 2016