Skip to content

Instantly share code, notes, and snippets.

@kevinkirkup
Last active November 26, 2015 13:01
Show Gist options
  • Save kevinkirkup/9edd97dba87fa0936e52 to your computer and use it in GitHub Desktop.
Save kevinkirkup/9edd97dba87fa0936e52 to your computer and use it in GitHub Desktop.
// Create an enum for the tags specified in IB
enum TabItems : Int {
case FirstTab = 0
case SecondTab
case ThirdTab
}
// Use a switch to handle each item
for item in self.tabBar.items {
if let tabItem = TabItems(fromraw: item.tag) {
switch tabItem {
case .FirstTab:
println("first tab")
case .SecondTab:
println("second tab")
default:
println("not recognized")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment