Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Swift iOS Architecture with FLUX in mind. UA Mobile 2016.

956 views

Published on

Алексей Демедецкий. iOS-разработчик.

Published in: Software

Swift iOS Architecture with FLUX in mind. UA Mobile 2016.

  1. 1. @DAlooG SWIFT AND FLUX New age of iOS development 1
  2. 2. @DAlooG ABOUT ME ➤iOS Developer at Sigma Software ➤Enterprise and client applications ➤Team leader ➤Mentor ➤Consultant 2
  3. 3. @DAlooG OBJECTIVE C And messed view controllers 3
  4. 4. @DAlooG PRE IPAD ➤Single UIViewController at screen ➤Single static layout ➤Table based layout 4
  5. 5. @DAlooG APPLE SOLUTION https://developer.apple.com/library/ios/documentation/General/Conceptual/ CocoaEncyclopedia/Model-View-Controller/Model-View-Controller.html#//apple_ref/doc/ uid/TP40010810-CH14-SW14 5
  6. 6. @DAlooG IPAD - SIZE CLASSES ➤Containment API ➤AutoLayout ➤Network availability ➤Storyboards 6
  7. 7. @DAlooG APPLE SOLUTION https://developer.apple.com/library/ios/documentation/General/Conceptual/DevPedia- CocoaCore/MVC.html 7
  8. 8. @DAlooG PROBLEMS ➤Controller need to rule view and model layers ➤View receive updates. So order of updates is important ➤Model receive updates. So order of updates is important ➤Controller is bloated with responsibilities 8
  9. 9. @DAlooG COMPONENT KIT http://componentkit.org 9
  10. 10. @DAlooG REACT https://facebook.github.io/react/ 10
  11. 11. « @DAlooG I say with confidence as a former UIKit author: React's model for the UI layer is vastly better than UIKit's. React Native is a *huge* deal. https://twitter.com/andy_matuschak/ status/560511204867575808 11
  12. 12. @DAlooG UI = VIEW(DATA) View layer is an function from data to user interface 12
  13. 13. « @DAlooG One can merge the MVC roles played by an object, making an object, for example, fulfill both the controller and view roles—in which case, it would be called a view controller. http://apple.co/1U6DPF3 13
  14. 14. @DAlooG UIVC == VIEW 14 😱
  15. 15. @DAlooG VIEW LAYER PROPS ➤Data driven ➤Testable ➤No state ➤No context 15
  16. 16. @DAlooG PRE SWIFT ➤VIPER ➤MVVM ➤Reactive Programming (mostly RAC) 16
  17. 17. @DAlooG SWIFT 17
  18. 18. @DAlooG 🦄 PROMISED LAND ➤Modern syntax ➤Generics ➤Enums ➤Structs ➤Closures ➤Protocols 18
  19. 19. @DAlooG APPLE SOLUTION https://developer.apple.com/library/ios/documentation/General/Conceptual/DevPedia- CocoaCore/MVC.html 19
  20. 20. @DAlooG SERIOUSLY? 20
  21. 21. @DAlooG FLUX https://facebook.github.io/flux/ 21
  22. 22. @DAlooG ➤Store ➤View ➤Action ➤Dispatcher 22 🔭
  23. 23. @DAlooG ACTION / COMMAND ➤Representation of increment ➤User actions (tap, gestures, shake) ➤API callbacks ➤Timer events ➤Action is immutable ➤Action is serializable ➤Action is printable 23
  24. 24. @DAlooG ACTION / COMMAND 24
  25. 25. @DAlooG STORE / REDUCER / UPDATE ➤Stores data ➤Update data according to actions ➤Notify listeners about data updates ➤Most application logic lives here ➤Covered with Unit Tests ➤Implemented as class 25
  26. 26. @DAlooG STATE ➤Immutable value type ➤Valid most of the times ➤Domain specific ➤Implemented as struct 26
  27. 27. @DAlooG ➤Store ➤View ➤Action ➤Dispatcher 27
  28. 28. @DAlooG WHY? 28
  29. 29. @DAlooG CQRS http://martinfowler.com/bliki/CQRS.html 29
  30. 30. @DAlooG 30
  31. 31. @DAlooG 31
  32. 32. @DAlooG Service Client Query Command CQRS 32
  33. 33. @DAlooG LINKS ➤http://blog.benjamin-encz.de/a-flux-inspired-architecture- for-ios/ ➤https://developer.apple.com/library/ios/documentation/ General/Conceptual/CocoaEncyclopedia/Model-View- Controller/Model-View-Controller.html#//apple_ref/doc/ uid/TP40010810-CH14 ➤https://developer.apple.com/library/ios/documentation/ General/Conceptual/DevPedia-CocoaCore/MVC.html ➤https://github.com/yonekawa/SwiftFlux ➤https://github.com/ReduxKit/ReduxKit ➤https://github.com/ReSwift/ReSwift
  34. 34. @DAlooG Q? dalog@me.com 34 🎉

×