2

I am trying to increment the tab bar badge once I get a notification.

In swift2.1 this worked:

if let badgeValue = tabBarController?.tabBar.items?[1].badgeValue,
    nextValue = Int(badgeValue)?.successor() {
    tabBarController?.tabBar.items?[1].badgeValue = String(nextValue)
} else {
    tabBarController?.tabBar.items?[1].badgeValue = "1"
}

But is there any other way to make this work in Swift 3? The successor() does not work

user2722667
  • 8,195
  • 14
  • 52
  • 100

0 Answers0