TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jan 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Daniel KIM.
Bedgeable is a protocol can display badge into your any custom UI components or even apply all UIView.
If you prefer to install manually.
Badgeable.swift
file into your Xcode project.Add import
syntax where you would conform Badgeable
protocol.
import Badgeable
Conform Badgeable
protocol where you want to display badge.
// Conform Badgeable protocol in your class.
class YourButton: UIButton, Badgeable {
// ...
}
Then you can display badge by setting badgeCount
property.
class YourViewController: UIViewController {
@IBOutlet weak var button: YourButton!
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
button.badgeCount = 6
}
}
You can conform Badgeable
protocol even UIView by extension.
// Conformance Badgeable into UIView
extension UIView: Badgeable {}
Then all UI components can display badge by setting badgeCount
property.
Daniel (Dae Hyun) KIM, [email protected]
Badgeable is available under the MIT license. See the LICENSE file for more info.