TDBadgedCell grew out of the need for TableViewCell badges and the lack of them in iOS (see the article explaining this on TUAW. Recently the project has been re-written in Swift and much simplified.
Add this to your project using Swift Package Manager. In Xcode that is simply: File > Swift Packages > Add Package Dependency... and you're done. Alternative installations options are shown below for legacy projects.
If you are already using CocoaPods, just add 'TDBadgedCell' to your Podfile
then run pod install
.
If you are already using Carthage, just add to your Cartfile
:
github "fulldecent/TDBadgedCell" ~> 0.1
Then run carthage update
to build the framework and drag the built TDBadgedCell
.framework into your Xcode project.
Note: You can find the old Objective-C version on the deprecated-objective-c branch.
To set the content of your badge (String) simply do:
cell.badgeString = "Hello, World!"
You can set badgeColor and badgeColorHighlighted to modify the colour of the badges:
cell.badgeColor = UIColor.orangeColor()
You can also specify a border radius and font size for your badges:
cell.badgeRadius = 9;
cell.badgeFontSize = 18;
TDBadgedCell is a free to use class for everyone. I wrote it so people could have the badges Apple never provided us with. If you modify the source please share alike and if you think you've improved upon what I have written I recommend sending me a pull request.
Please note: If you are using TDBadgedCell in your project please make sure you leave credit where credit is due. Chances are I won't notice if you haven't left credit but karma will…