/Antidote

Antidote Architecture (Cure for VIPER snakebite)

Primary LanguageSwiftMIT LicenseMIT

Antidote

Antidote Architecture Example

Folder
File

Antidote Architecture:

  • App Flow
    • AppDelegate
    • AppFlowCoordinator
      • Authentication Flow
        • FlowCoordinator
        • ViewControllersFactory
        • Sign In
          • ViewController
          • ViewManager
          • NetworkService
          • StorageService
        • Reset password
          • ViewController
          • ViewManager
          • NetworkService
          • StorageService
      • Menu Flow
        • FlowCoordinator
        • ViewControllersFactory
        • Menu
          • ViewController
          • ViewManager
          • NetworkService
          • StorageService

Flow Coordinator Types:

  • Menu
  • Master-Detail
  • Page-Based
  • Tabbed
  • Push into current UINavigationController
  • Present modally
  • Present inside container

Questions:

  • Handle container presentation logic and callbacks? Use public function + callbacks (look at User Container)
  • Who must call and setup closeHandler? - current Coordinator setup child's closeHandler, and called own closeHandler.
  • Childcoordinators as array(stack) OR as stored properties? (how to remove childcoordinator then push into current UINavigationController)

Q&A

Open issue and write all yours questions!
I will answer your questions there :)

Marks:

Andrey Panov Suggest: Если мы пушаем контроллеры и в какой-то момент нужно перейти на новый флоу, то фабрика создает новый координатор, использую текущий navController. А у завершающего флоу контроллера должен быть коллбек в конфигуре которого можно удалить зависимость. Сам колбек можно ловить так:

override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        if isMovingFromParentViewController {
            onPopController?(confirmed)
        }
    }   

У меня в примере можешь посмотреть TermsController и AuthCoordinator.