Implementation of Clean Architecture using FRP

Implementation of Clean Architecture using FRP

Talk by Daria Kovalenko

Даша расскажет о реализации принципов Clean Architecture с использованием FRP (RxSwift).
Что будет:
- решение типовых задач и проблем
- лайфхаки и операторы
Чего не будет:
- унылой теории

This talk was made for CocoaFriday #4 ( https://cocoaheads.org.ua/cocoafriday/4) which took place Jun 14, 2019

Video: https://youtu.be/bTwvSDZhs3I

Db84cf61fdada06b63f43f310b68b462?s=128

CocoaHeads Ukraine

June 14, 2019
Tweet

Transcript

  1. Implementation of Clean Architecture using FRP Daria Kovalenko iOS Developer

    at Anadea
  2. View

  3. View - UIKit (UIViewController, UIView) - layouts - animations -

    user’s actions
  4. Store

  5. Store Store Rest Services DAOs Local storage Profile Store Order

    Store Contacts Store
  6. Store - fetches data from network - stores data in

    local storage - updates data - creates/deletes stores - switches to other stores
  7. Page

  8. Page - fetches data from store - transforms store data

    for presentation - transforms store data to subpages - sends updates to store - owns store - generates other pages
  9. Store Page View Dependency rule

  10. Why RxSwift? Store: Observable Page: Observable, BehaviorSubject (PublishRelay, BehaviorRelay), Action

    View: RxCocoa extensions, RxDataSources etc
  11. None
  12. How it works?

  13. Store extension example

  14. Store

  15. Base pages

  16. None
  17. None
  18. None
  19. None
  20. Bind with RxSwift

  21. Bind operator ||>

  22. Bind operator <||>

  23. Before: After:

  24. Navigation

  25. UIViewController Page User action

  26. UIViewController Page User action Next Page Controller Navigator

  27. UIViewController Page User action Next Page Controller Navigator Router Next

    Page
  28. UIViewController Page User action Next Page Controller Navigator Creates next

    UIViewController Router Next Page
  29. UIViewController Page User action Next Page Controller Navigator Creates next

    UIViewController Router Next Page Presents next UIViewController
  30. Router (first vision)

  31. Protocols for binding page and UIViewControllers

  32. Controller creation

  33. None
  34. Conclusions - independent layers - changes of store does not

    change UI and vice versa - different ViewControllers can be built in different ways (storyboards, nibs, pin layouts etc) - UI components can be wrapped to RxCocoa and easy binded - needs extra input/output models between layers - need to handle side effects of bindings - control disposeBag for binding on different type of UI - UITableViewCells, subviews to avoid multiple bindings
  35. Questions