RMHoldButton is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "RMHoldButton"In Terminal, cd to the project directory and run pod install.
Import the lib to any class using it
import RMHoldButtonYou can create an RMHoldButton from the Storyboard or programatically.
- Drag a UIButton onto your view.
 - Change it's class to 
RMHoldButton - Edit it's appearance using the custom properties in the Attributes Inspector
 - Create the button as a property of it's View Controller
 - In the 
viewDidLoad()method of your View Controller, set the button'sholdButtonCompletionproperty to tell the button what to do when it's done animating. 
For an example of creating a RMHoldButton in storyboard, check out the example project.
- Initialize the button
 - Set the button's 
holdButtonCompletionproperty to tell the button what to do when it's done animating. 
Example:
let holdButton = RMHoldButton(frame: CGRect(x: 0, y: 0 , width: 200, height: 50), slideColor: UIColor.green, slideTextColor: UIColor.white, slideDuration: 1.0)
holdButton.backgroundColor = UIColor.clear
holdButton.setText("✓")
holdButton.setTextFont(UIFont.boldSystemFont(ofSize: 60))
holdButton.textColor = UIColor.green
holdButton.holdButtonCompletion = {() -> Void in
    print("Hold button has completed!")
}
holdButton.resetDuration = 0.2
holdButton.borderWidth = 3.0
holdButton.borderColor = UIColor.green
holdButton.cornerRadius = holdButton.frame.width / 2
self.view.addSubview(holdButton)For a better idea of RMHoldButton's versatility, look at the example project in the repo.
Pawel Decowski, [email protected] Dan Sinclair, [email protected]
RMHoldButton is available under the MIT license. See the LICENSE file for more info.