A quick way to add badge icon on the UIView elements.
use_frameworks!
target 'yourApp' do
platform :ios, '9.0'
pod 'KGBadgeView', '~> 1.0'
end
let kgBadgeObj = KGBadgeView()
kgBadgeObj.initWithView(view: yourViewElement)
kgBadgeObj.setCount(2)
kgBadgeObj.showCount()
kgBadgeObj.setFont(fontObj: UIFont(name: "HelveticaNeue", size: 20)!)
kgBadgeObj.setSize(width: 25, height: 25)
kgBadgeObj.setBackgroundColor(color: UIColor.red)
kgBadgeObj.setTextColor(color: UIColor.white)
To set position for a badge use teh following
kgBadgeObj.setPostion(xAxis: 110, yAxis: -10)
kgBadgeObj.showAnimation(type: KGBadgeView.AnimType.shakeAnim)
Different animations,
- KGBadgeView.AnimType.defaultAnim
- KGBadgeView.AnimType.shakeAnim
- KGBadgeView.AnimType.blinkAnim
- KGBadgeView.AnimType.swingAnim
- KGBadgeView.AnimType.pulseAnim
For support raise an issue here.
Please feel free to contribute 💪✌️💯