Skip to content

millenagm/Badgeable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Badgeable

Bedgeable is a protocol can display badge into your any custom UI components or even apply all UIView.

image

Installation

Swift Package Manager

Xcode

File > Swift Packages > Add Package Dependency

Enter https://github.com/millenagm/Badgeable.git in the "Choose Package Repository" dialog.

Manually

If you prefer to install manually.

  • Drop Badgeable.swift file into your Xcode project.

Usage

Conform Badgeable protocol where you want to display badge. Then you can display badge by setting badgeCount property.

class CustomButton: UIButton, Badgable { }

or by extension

extension UIView: Badgeable {}

You can change the appearance.

view.badgeCount = 6
view.maxValue = 5 // will show (5+)
view.badgeColor = .orange
view.badgePosition = .topRight