Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Buckets of Code

Buckets of Code

Presented at dotSwift Paris 2018

023a6a37e8177cb2f84a236bbce643cf?s=128

Ben Scheirman

January 29, 2018
Tweet

Transcript

  1. Buckets of Code Ben Scheirman @subdigital

  2. M V C

  3. M C V

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

  5. None
  6. M V C

  7. M V C

  8. 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
  9. 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?
  10. Ship Great Products

  11. Iterate

  12. Embrace Change

  13. Ship Great Products

  14. Ship Great Products

  15. Ship Great Products Complexity

  16. None
  17. How do I get better?

  18. Give each object a job

  19. None
  20. Give yourself more buckets

  21. Photo from MKBHD

  22. “Massive View Controller”

  23. View Layout in View Controllers Scenario

  24. None
  25. Rounded Image Shadow Rounded Corner Sections Thin Line Borders Custom

    Highlight Color
  26. None
  27. None
  28. None
  29. None
  30. STOP Arrêt

  31. Extract some views

  32. None
  33. ProfileAvatarView StatSectionView ActionStrip ActionStripButton

  34. c v v v v

  35. c v v v v •Smaller Controller

  36. c v v v v •Smaller Controller •Simpler Autolayout

  37. c v v v v •Smaller Controller •Simpler Autolayout •Easier

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

    Reuse •Leverage @IBDesignable
  39. View Controller Flow Scenario

  40. Nav A

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

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

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

  44. A B Know your dependencies!

  45. Nav A B

  46. Nav A B ?

  47. Nav A B Coordinator

  48. Coordinator

  49. Coordinator

  50. Coordinator

  51. Coordinator

  52. Coordinator

  53. Nav Window

  54. DataManager API Client Nav Window

  55. UITabBarController DataManager API Client Nav Nav Nav Window

  56. UITabBarController DataManager API Client Nav Nav Nav Window Coordinator

  57. None
  58. None
  59. UITabBarController DataManager API Client Nav Nav Nav Window Coordinator

  60. UITabBarController DataManager API Client Nav Nav Nav Window Coordinator

  61. UITabBarController DataManager API Client Nav Nav Nav Window Coordinator

  62. Nav UITabBarController DataManager API Client Nav Nav Window Coordinator

  63. Nav UITabBarController DataManager API Client Nav Nav Window Coordinator

  64. Extract View Controller Scenario

  65. 1 Screen ≠ 1 View Controller

  66. None
  67. • Profile • Stats • Send Message • Follow Profile

    Header
  68. • Books • Tap to View Book Book List

  69. ProfileViewController

  70. ProfileViewController ProfileHeaderViewController

  71. UITabBarController DataManager API Client Nav Nav Nav Window Coordinator

  72. UITabBarController DataManager API Client Nav Nav Nav Window AppController

  73. UITabBarController DataManager API Client Nav Nav Nav Window AppController

  74. UITabBarController DataManager API Client Nav Nav Nav Window AppController

  75. None
  76. None
  77. Give yourself more buckets

  78. Ship Great Products

  79. Thank you Ben Scheirman @subdigital nsscreencast.com