Skip to content

A pure-swift, lightweight GUI library for display a badge.

License

Notifications You must be signed in to change notification settings

1159148169/SFBadge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SFBadge

SFBadge is a pure-swift, lightweight GUI library for display a badge, fits any UIView.

Features

image

Install

Just download my project, then copy SFBadge.swift to your project, that's all!

Use

UITableViewCell has different API from other UIView,just for display cool. You can use it easily by:

testButton.setBadge(badgeID: 1, badgeNum: 10) //You set badge number 10.
cell.setBadgeForCell(badgeID: 2, badgeNum: 10)

Or you can customize more by:

testButton.setBadge(badgeID: 3, badgeNum: 10, badgeColor: UIColor.red, badgeAnimate: false, badgeToIcon: false)
cell.setBadgeForCell(badgeID: 4, badgeNum: 0, badgeForText: true, badgeColor: UIColor.clear, badgeAnimate: true, badgeToIcon: false, badgeText: "SFBadgeForCell") //You set a text badge for cell.
cell.setBadgeForCell(badgeID: 5, badgeNum: 10, badgeForText: false, badgeColor: UIColor.blue, badgeAnimate: true, badgeToIcon: false, badgeText: "") //You set a normal badge for cell.

Attention: You must set a ID for every badge,because I use ID to change badge and remove badge. You can change badge num by setBadge method or:

testButton.changeBadgeNum(badgeID: 1, newBadgeNum: 11, badgeToIcon: false)
cell.changeBadgeNumForCell(badgeID: 2, newBadgeNum: 11, badgeToIcon: false)

You can remove badge by:

testButton.removeBadge(badgeID: 1, badgeToIcon: false)
cell.removeBadgeForCell(badgeID: 2, badgeToIcon: false)

Others

If you find any bug or have better advice,please contact me.Thank you!

License

MIT license.

About

A pure-swift, lightweight GUI library for display a badge.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages