Created
July 2, 2020 15:16
-
-
Save RustemAqtau/a736bb2ff11c4679b1db4ac12b74d0b4 to your computer and use it in GitHub Desktop.
TabController UIKIt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class MainTabBarController: UITabBarController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let listViewController = ListViewController() | |
let peopleViewController = PeopleViewController() | |
tabBar.tintColor = #colorLiteral(red: 0.5568627715, green: 0.3529411852, blue: 0.9686274529, alpha: 1) | |
let boldConfig = UIImage.SymbolConfiguration(weight: .medium) | |
let convImage = UIImage(systemName: "bubble.left.and.bubble.right", withConfiguration: boldConfig)! | |
let peopleImage = UIImage(systemName: "person.2", withConfiguration: boldConfig)! | |
viewControllers = [ | |
generateNavigationController(rootViewController: listViewController, title: "Conversations", image: convImage), | |
generateNavigationController(rootViewController: peopleViewController, title: "People", image: peopleImage) | |
] | |
} | |
private func generateNavigationController(rootViewController: UIViewController, title: String, image: UIImage) -> UIViewController { | |
let navigationVC = UINavigationController(rootViewController: rootViewController) | |
navigationVC.tabBarItem.title = title | |
navigationVC.tabBarItem.image = image | |
return navigationVC | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment