Slide 1

Slide 1 text

Backend Driven UIs

Slide 2

Slide 2 text

PhonePe iOS Engineer raywenderlich.com Contributor

Slide 3

Slide 3 text

How we build it now?

Slide 4

Slide 4 text

We make a TableView or a CollectionView.

Slide 5

Slide 5 text

Includes a lot of boilerplate, which you are tired of writing.

Slide 6

Slide 6 text

Bloats the app.

Slide 7

Slide 7 text

We keep on doing this till infinity.

Slide 8

Slide 8 text

The main turn off

Slide 9

Slide 9 text

Design Iterations

Slide 10

Slide 10 text

Changing that same view

Slide 11

Slide 11 text

Again

Slide 12

Slide 12 text

And Again

Slide 13

Slide 13 text

Again.

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Make it independent

Slide 16

Slide 16 text

“Driving it from the backend”

Slide 17

Slide 17 text

Why would you want such a thing?

Slide 18

Slide 18 text

It is purely use-case dependent.

Slide 19

Slide 19 text

SwiftUI has not taken over the world right now.

Slide 20

Slide 20 text

Consistency

Slide 21

Slide 21 text

Adaptability

Slide 22

Slide 22 text

Iterative

Slide 23

Slide 23 text

Scaleable

Slide 24

Slide 24 text

Prerequisites

Slide 25

Slide 25 text

Design System

Slide 26

Slide 26 text

Steps to uniforming your UI

Slide 27

Slide 27 text

Invest time in making a uniform design system

Slide 28

Slide 28 text

Many Design tools such as Figma, Sketch, Adobe XD.

Slide 29

Slide 29 text

The most important part.

Slide 30

Slide 30 text

Get that design system into code

Slide 31

Slide 31 text

Make it driven from the backend.

Slide 32

Slide 32 text

Laying our views realtime

Slide 33

Slide 33 text

UICollectionView

Slide 34

Slide 34 text

Consists of two entities

Slide 35

Slide 35 text

Data and Layout

Slide 36

Slide 36 text

Layout

Slide 37

Slide 37 text

ViewType

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

ScrollType

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

Data

Slide 42

Slide 42 text

Data is just an array of objects, which includes necessary parameters like title, image etc.

Slide 43

Slide 43 text

UI Elements

Slide 44

Slide 44 text

BaseView

Slide 45

Slide 45 text

BaseView is a UIView + A protocol which has all necessary information to calculate sizes, set some data and so on.

Slide 46

Slide 46 text

BaseCollectionViewCell

Slide 47

Slide 47 text

BaseCollectionViewCell is a CVC which has all relevant information on calculating size and for the layout of the rest of the view.

Slide 48

Slide 48 text

BaseTableViewCell

Slide 49

Slide 49 text

BaseTableViewCell is a container which holds all our collectionViews

Slide 50

Slide 50 text

Some Code

Slide 51

Slide 51 text

Handling Clicks

Slide 52

Slide 52 text

Deeplinks and ViewModels

Slide 53

Slide 53 text

Deeplinks are the key here for in-app navigation

Slide 54

Slide 54 text

Some Pros

Slide 55

Slide 55 text

Scaleable

Slide 56

Slide 56 text

Testable

Slide 57

Slide 57 text

No intervention necessary

Slide 58

Slide 58 text

Realtime Updates

Slide 59

Slide 59 text

Fast and hassle-free

Slide 60

Slide 60 text

Can last you at least a year if done properly.

Slide 61

Slide 61 text

Can last you at least a year if done properly. Unless you have a crazy designer

Slide 62

Slide 62 text

Some Cons

Slide 63

Slide 63 text

Performance

Slide 64

Slide 64 text

Overkill

Slide 65

Slide 65 text

Idk if it works with Storyboards

Slide 66

Slide 66 text

What can be improved?

Slide 67

Slide 67 text

Height Calculations

Slide 68

Slide 68 text

Height Caching

Slide 69

Slide 69 text

Some boilerplate

Slide 70

Slide 70 text

Questions, Suggestions, Ideas!

Slide 71

Slide 71 text

Thanks @soulful_swift