Search code examples
iosswiftswift2badgeuibuttonbaritem

Badge on top of right navigation button


I have a requirement where I need to show the badge number on top of the right navigation button. Something like this:

enter image description here

How to show the badge on top of UIBarButtonItem in the navigation bar?

I am still using Xcode 7.3.1, Swift 2.2.


Solution

  • I am working with this Framework here:

    https://github.com/enmiller/ENMBadgedBarButtonItem-Swift

    Otherwise you could create your own View with a Badge. Just make an Custom UINavigationItem.

    For example:

    let rightBarButton = UIBarButtonItem(customView: AnyOfYourCustomViews)