Skip to content

Instantly share code, notes, and snippets.

@AlexGladkov
Created July 9, 2020 14:37
Show Gist options
  • Save AlexGladkov/f4fe6de55c65070c8102b288d7b132fe to your computer and use it in GitHub Desktop.
Save AlexGladkov/f4fe6de55c65070c8102b288d7b132fe to your computer and use it in GitHub Desktop.
// TODO: - Рефакторинг - разбить на более мелкие функции
func mainFlowController() -> UIViewController {
// NavigationBar setting
AppAppearance.applyAppearanceNavigationbBarStyle()
AppAppearance.applyAppearanceBarButtonItem()
// creates a Home tab
let homeVC: HomeViewController = ControllerFactory.createViewController()
let homeNav = LMNavigationController(rootViewController: homeVC)
homeNav.tabBarItem.title = L10n.ATestHome.title
homeNav.tabBarItem.image = #imageLiteral(resourceName: "ATestTabBar-main-ico")
// creates a Shopping Lists tab
let myListsViewController: MyListsViewController = ControllerFactory.createViewController()
let myListsNavigationController = LMNavigationController(rootViewController: myListsViewController)
myListsNavigationController.tabBarItem.title = L10n.ShoppingList.aTestTitle
myListsNavigationController.tabBarItem.image = #imageLiteral(resourceName: "ATestTabBar-shoppingList-ico")
// creates a Map tab
let mapVC: MapViewController = ControllerFactory.createViewController()
let mapNav = LMNavigationController(rootViewController: mapVC)
mapNav.tabBarItem.title = L10n.Map.title
mapNav.tabBarItem.image = #imageLiteral(resourceName: "ATestTabBar-shops-ico")
// creates a Profile tab
let profileVC: ProfileViewController = ControllerFactory.createViewController()
let profileNav = LMNavigationController(rootViewController: profileVC)
profileNav.tabBarItem.title = L10n.Profile.TabBarItem.title
profileNav.tabBarItem.image = #imageLiteral(resourceName: "ATestTabBar-profile-ico")
// creates a Cart tab
let cartViewController: CartViewController = ControllerFactory.createViewController()
let cartNav = LMNavigationController(rootViewController: cartViewController)
cartNav.tabBarItem.title = L10n.Cart.title
cartNav.tabBarItem.image = #imageLiteral(resourceName: "ATestTabBar-basket-ico")
return ContainerController(with: [homeNav, myListsNavigationController, mapNav, profileNav, cartNav])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment