To run the example project, clone the repo, and run pod install
from the Example directory first.
GLScratchCard
XCode 10 and Swift 4.2. With deployment target 11.0
.
GLScratchCard
is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'GLScratchCard'
Copy the files from ~/Pods/DevelopmentPods/GLScratchCard/ to your project.
let controller = GLScratchCardController()
controller.scratchCardView.addDelegate(delegate: self)
controller.scratchCardView.bottomLayerView = UIImageView(image: UIImage(named: "cash_back"))
controller.scratchCardView.topLayerImage = UIImage(named:"scratch_image")!
controller.presentScratchController()
let controller = GLScratchCardController()
Titles to be shown initilly, before scratch starts
controller.scratchCardView.doneButtonTitle = "Gift to a friend"
controller.scratchCardView.scratchCardTitle = "Earn up to βΉ1,0000"
controller.scratchCardView.scratchCardSubTitle = "From Google Pay \nEarned for paying \nGokul"
Title to be show after scratch ends,
controller.scratchCardView.afterScratchDoneButtonTitle = "Done"
controller.scratchCardView.afterScratchTitle = "Woohoo!"
controller.scratchCardView.afterScratchSubTitle = "Expect payment within a weak."
Top layer image view,
controller.scratchCardView.topLayerImage = UIImage(named:"scratch_image")!
Bottom layer image view (one that will be reviled after scratching ends),
controller.scratchCardView.bottomLayerView = UIImageView(image: UIImage(named: "cash_back"))
Can customise scratch size and shape (.round, .square, .butt),
controller.scratchCardView.scratchCardImageView.lineWidth = 50
controller.scratchCardView.scratchCardImageView.lineType = .round
GLScratchCardDelegate
GLScratchCarImageViewDelegate
Add delegates,
controller.scratchCardView.addDelegate(delegate: self)
controller.scratchCardView.scratchCardImageView.addDelegate(delegate:self)
func didCloseButtonPressed(sender: UIButton)
func didDoneButtonPressed(sender: UIButton)
func scratchpercentageDidChange(value: Float)
func didScratchStarted()
func didScratchEnded()
Gokul, [email protected]
GLScratchCard is available under the MIT license. See the LICENSE file for more info.