Implemented the functionality of Medium.com Claps.
- Create Programmatically or in Storyboard.
- Dynamic Property Configurations.
- Replica of Medium.com's Claps.
- Lightweight with zero dependancies.
- Storyboard β Add a
UIView
and change the class in Identity Inspector toClapsView
. - Manually β Add
ClapsView.swift
file to your Project. - CocoaPods β
pod 'ClapsView'
You can read the CHANGELOG file for a particular release.
- Long Press β To start clapping. π
- Double Tap - To remove current claps.
- Single Tap - To see current Claps.
import ClapsView
let claps = ClapsView.init(frame: CGRect.init(origin: CGPoint.zero, size: CGSize.init(width: 100.0, height: 100.0)))
claps.delegate = self
//Customize Emoji.
claps.emoji = "π"
//The number of claps by all of the user.
claps.totalClaps = 30
//The maximum number of claps a user can do.
claps.maxClaps = 50
//If set true, 1000 claps will be display as 1k
claps.showClapsAbbreviated = true
self.view.addSubview(claps)
claps.center = self.view.center
//Implementing Delegate Call
extension ViewController: ClapsViewDelegate {
func clapsViewStateChanged(clapsView: ClapsView, state: ClapsViewStates, totalClaps: Int, currentClaps: Int) {
if state == .finalized {
print("ClapsViewTag: \(clapsView.tag) | Total Claps:\(totalClaps) | Current Claps:\(currentClaps)")
}
}
}
- CocoaPods Support
You can watch to ClapsView to see continuous updates. Stay tuned.
Have an idea for improvements of this class? Please open an issue. Β Β
You can shoot me an email to contact. Β
See the contributions for details.
The MIT License (MIT)
Read the LICENSE file for details.