Skip to content

Latest commit

 

History

History
45 lines (28 loc) · 861 Bytes

README.md

File metadata and controls

45 lines (28 loc) · 861 Bytes

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