Skip to content

Instantly share code, notes, and snippets.

@lukewakeford
Last active January 6, 2017 12:25
Show Gist options
  • Save lukewakeford/62860fc90ef043412cd739b0914dd77b to your computer and use it in GitHub Desktop.
Save lukewakeford/62860fc90ef043412cd739b0914dd77b to your computer and use it in GitHub Desktop.
Tab Bar Example
class CustomTabbar:UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
let data = [
1:"data",
2:"data",
3:"data",
4:"data"
]
var viewControllers = Array<UIViewController>()
for (key,value) in data {
let vc = CustomViewController()
vc.tabBarItem = UITabBarItem() // You can set the bar item here if you want, otherwise it should us defaults.
vc.id = key
vc.data = value
viewControllers.append(vc)
}
self.setViewControllers(viewControllers, animated: true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment