SkillAgentSearch skills...

FFBadgedBarButtonItem

FFBadgedBarButtonItem is a UIBarButtonItem subclass that allows you to create a button with a custom image that supports badging for the Navigation Bar.

Install / Use

/learn @granoff/FFBadgedBarButtonItem
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

FFBadgedBarButtonItem

Build Status

FFBadgedBarButtonItem is a UIBarButtonItem subclass that allows you to create a button with a custom image that supports badging for the Navigation Bar.

Note: iOS 26 introduced direct support for badging bar button items. This package was updated to remain compatible by renaming its badge attribute to badgeText. If you are targetting iOS 26+, you should probably just use the native support there. :-)

Overview

Icon badges and tab badges are used commonly to convey information to the user that there is something that needs their attention. A bit surprisingly, there is no support for badging UIBarButtonItem's, however. Enter FFBadgedBarButtonItem.

Utilizing the UIBarButtonItem's customView attribute, FFBadgedBarButtonItem allows you to create a button with a custom image that supports badging.

Usage

Using FFBadgedBarButtonItem is easy:

Add FFBadgedBarButtonItem.{h,m} to your project, and include the .h file where you need it.

Create the button:

UIImage *image = /* ... */
self.navigationItem.leftBarButtonItem = [[FFBadgedBarButtonItem alloc] initWithImage:image target:self action:@selector(doSomething:)];

Update the badge:

FFBadgedBarButtonItem *button = (FFBadgedBarButtonItem *)self.navigationItem.leftBarButtonItem;
button.badgeText = @"3";

License

See the LICENSE file for details.

View on GitHub
GitHub Stars37
CategoryCustomer
Updated6mo ago
Forks3

Languages

Objective-C

Security Score

87/100

Audited on Oct 4, 2025

No findings