Skip to content

Instantly share code, notes, and snippets.

@Yerazhas
Last active June 15, 2020 07:13
Show Gist options
  • Select an option

  • Save Yerazhas/07a4d5e7193a9d793fd444cf2e5eeb1d to your computer and use it in GitHub Desktop.

Select an option

Save Yerazhas/07a4d5e7193a9d793fd444cf2e5eeb1d to your computer and use it in GitHub Desktop.
let firstVC = UINavigationController(rootViewController: DialogsController(networkManager: networkManager, socketClient: chatManager)).userSideMenu()
let secondVC = UINavigationController(rootViewController: MainController(networkManager: networkManager, offlineManager: OfflineManager(), categoryId: 1)).userSideMenu()
let thirdVC = UINavigationController(rootViewController: NotificationsController(networkManager: networkManager)).userSideMenu()
let fourthVC = UIViewController()
firstVC.delegate = self
secondVC.delegate = self
thirdVC.delegate = self
firstVC.tabBarItem = ESTabBarItem.init(ESTabBarItemContentView(), title: nil, image: #imageLiteral(resourceName: "comment-white-oval-bubble").withRenderingMode(.alwaysOriginal), selectedImage: #imageLiteral(resourceName: "comment-white-oval-bubble").withRenderingMode(.alwaysOriginal))
secondVC.tabBarItem = ESTabBarItem.init(ESTabBarItemContentView(), title: nil, image: #imageLiteral(resourceName: "icon").withRenderingMode(.alwaysOriginal), selectedImage: #imageLiteral(resourceName: "icon").withRenderingMode(.alwaysOriginal))
thirdVC.tabBarItem = ESTabBarItem.init(ESTabBarItemContentView(), title: nil, image: #imageLiteral(resourceName: "alarm").withRenderingMode(.alwaysOriginal), selectedImage: #imageLiteral(resourceName: "alarm").withRenderingMode(.alwaysOriginal))
fourthVC.tabBarItem = ESTabBarItem.init(ESTabBarItemContentView(), title: nil, image: #imageLiteral(resourceName: "Group 349").withRenderingMode(.alwaysOriginal), selectedImage: #imageLiteral(resourceName: "Group 349").withRenderingMode(.alwaysOriginal))
viewControllers = [firstVC, secondVC, thirdVC, fourthVC]
tabBarController?.viewControllers = viewControllers
tabBarController?.shouldHijackHandler = { _, _, index in
return index == 3
}
tabBarController?.didHijackHandler = { [unowned self] viewController, _, _ in
if let vc = self.tabBarController?.selectedViewController, let sideMenuController = vc.sideMenuController {
sideMenuController.toggle()
}
}
tabBarController?.tabBar.tintColor = .buttonLightBlue
tabBarController?.selectedIndex = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment