Slide 1

Slide 1 text

Buckets of Code Ben Scheirman @subdigital

Slide 2

Slide 2 text

M V C

Slide 3

Slide 3 text

M C V

Slide 4

Slide 4 text

http://www.stevechapman.xyz/2016/03/three-buckets-can-change-your-life/ Model View Controller

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

M V C

Slide 7

Slide 7 text

M V C

Slide 8

Slide 8 text

TDD Inversion o Dependencies Separation of Concerns Liskov Substition Principle Composition over Inheritance Open/Closed Principle le Responsibility ’t repeat your self ndency Inversion ion Princip oncern Lisk Separ Compositio Open/Clos Sing nce ngle ty Sin ility O Si

Slide 9

Slide 9 text

TDD Inversion o Dependencies Separation of Concerns Liskov Substition Principle Composition over Inheritance Open/Closed Principle le Responsibility ’t repeat your self ndency Inversion ion Princip oncern Lisk Separ Compositio Open/Clos Sing nce ngle ty Sin ility O Si WHY?

Slide 10

Slide 10 text

Ship Great Products

Slide 11

Slide 11 text

Iterate

Slide 12

Slide 12 text

Embrace Change

Slide 13

Slide 13 text

Ship Great Products

Slide 14

Slide 14 text

Ship Great Products

Slide 15

Slide 15 text

Ship Great Products Complexity

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

How do I get better?

Slide 18

Slide 18 text

Give each object a job

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

Give yourself more buckets

Slide 21

Slide 21 text

Photo from MKBHD

Slide 22

Slide 22 text

“Massive View Controller”

Slide 23

Slide 23 text

View Layout in View Controllers Scenario

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

Rounded Image Shadow Rounded Corner Sections Thin Line Borders Custom Highlight Color

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

STOP Arrêt

Slide 31

Slide 31 text

Extract some views

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

ProfileAvatarView StatSectionView ActionStrip ActionStripButton

Slide 34

Slide 34 text

c v v v v

Slide 35

Slide 35 text

c v v v v •Smaller Controller

Slide 36

Slide 36 text

c v v v v •Smaller Controller •Simpler Autolayout

Slide 37

Slide 37 text

c v v v v •Smaller Controller •Simpler Autolayout •Easier Reuse

Slide 38

Slide 38 text

c v v v v •Smaller Controller •Simpler Autolayout •Easier Reuse •Leverage @IBDesignable

Slide 39

Slide 39 text

View Controller Flow Scenario

Slide 40

Slide 40 text

Nav A

Slide 41

Slide 41 text

Nav let detailVC = DetailViewController() detailVC.dependency = someDependency A

Slide 42

Slide 42 text

Nav let detailVC = DetailViewController() detailVC.dependency = someDependency A B

Slide 43

Slide 43 text

Nav self.navigationController?.show(otherVC, sender: self) A B

Slide 44

Slide 44 text

A B Know your dependencies!

Slide 45

Slide 45 text

Nav A B

Slide 46

Slide 46 text

Nav A B ?

Slide 47

Slide 47 text

Nav A B Coordinator

Slide 48

Slide 48 text

Coordinator

Slide 49

Slide 49 text

Coordinator

Slide 50

Slide 50 text

Coordinator

Slide 51

Slide 51 text

Coordinator

Slide 52

Slide 52 text

Coordinator

Slide 53

Slide 53 text

Nav Window

Slide 54

Slide 54 text

DataManager API Client Nav Window

Slide 55

Slide 55 text

UITabBarController DataManager API Client Nav Nav Nav Window

Slide 56

Slide 56 text

UITabBarController DataManager API Client Nav Nav Nav Window Coordinator

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

UITabBarController DataManager API Client Nav Nav Nav Window Coordinator

Slide 60

Slide 60 text

UITabBarController DataManager API Client Nav Nav Nav Window Coordinator

Slide 61

Slide 61 text

UITabBarController DataManager API Client Nav Nav Nav Window Coordinator

Slide 62

Slide 62 text

Nav UITabBarController DataManager API Client Nav Nav Window Coordinator

Slide 63

Slide 63 text

Nav UITabBarController DataManager API Client Nav Nav Window Coordinator

Slide 64

Slide 64 text

Extract View Controller Scenario

Slide 65

Slide 65 text

1 Screen ≠ 1 View Controller

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

• Profile • Stats • Send Message • Follow Profile Header

Slide 68

Slide 68 text

• Books • Tap to View Book Book List

Slide 69

Slide 69 text

ProfileViewController

Slide 70

Slide 70 text

ProfileViewController ProfileHeaderViewController

Slide 71

Slide 71 text

UITabBarController DataManager API Client Nav Nav Nav Window Coordinator

Slide 72

Slide 72 text

UITabBarController DataManager API Client Nav Nav Nav Window AppController

Slide 73

Slide 73 text

UITabBarController DataManager API Client Nav Nav Nav Window AppController

Slide 74

Slide 74 text

UITabBarController DataManager API Client Nav Nav Nav Window AppController

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

Give yourself more buckets

Slide 78

Slide 78 text

Ship Great Products

Slide 79

Slide 79 text

Thank you Ben Scheirman @subdigital nsscreencast.com