Skip to content

Instantly share code, notes, and snippets.

@nhatduong
Created May 13, 2022 10:05
Show Gist options
  • Select an option

  • Save nhatduong/502605600489b4cb8502777f758e55fe to your computer and use it in GitHub Desktop.

Select an option

Save nhatduong/502605600489b4cb8502777f758e55fe to your computer and use it in GitHub Desktop.
import UIKit
import ESTabBarController_swift
class StartApp: UIViewController {
static let shared = StartApp()
override func viewDidLoad() {
super.viewDidLoad()
setupTabbarApp(setTab: false, viewVC: Browser(), indexTab: 1)
}
func setupTabbarApp(setTab: Bool, viewVC: UIViewController, indexTab: Int) {
let window = UIWindow(frame: UIScreen.main.bounds)
let tabBarController = ESTabBarController()
tabBarController.tabBar.shadowImage = UIImage()
tabBarController.tabBar.backgroundImage = UIColor(named: "BlackColor")?.image()
tabBarController.tabBar.backgroundColor = UIColor(named: "BlackColor")
let NotificationView = NotifyViewController()
let NotificationNav = UINavigationController(rootViewController: NotificationView)
let BrowserView = ARBrowser()
let BrowserNav = UINavigationController(rootViewController: BrowserView)
let ProfileView = Profile()
let ProfileNav = UINavigationController(rootViewController: ProfileView)
NotificationView.tabBarItem = ESTabBarItem.init(IrregularityContentView(), title: "Inbox".localized, image: UIImage(named: "Bell"), selectedImage: UIImage(named: "Bell"))
BrowserView.tabBarItem = ESTabBarItem.init(CustomIconContentView(), title: nil, image: UIImage(), selectedImage: UIImage())
ProfileView.tabBarItem = ESTabBarItem.init(IrregularityContentView(), title: "Profile".localized, image: UIImage(named: "Personal"), selectedImage: UIImage(named: "Personal"))
tabBarController.viewControllers = [NotificationNav, BrowserNav, ProfileNav]
tabBarController.selectedIndex = 1
window.rootViewController = tabBarController
AppDelegate.window = window
window.makeKeyAndVisible()
}
func changeTab(viewVC: UIViewController, indexTab: Int) {
navigationController?.pushViewController(viewVC, animated: true)
let tabBar = AppDelegate.window?.rootViewController as? UITabBarController
tabBar?.selectedIndex = indexTab;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment