https://github.com/gokulgovind/glscratchcard
I loved the way payments app's like Google pay and PhonePe used scratch card option to reward it's user. Hence with 💛 cloned the same scratch card effect for you guys out there
https://github.com/gokulgovind/glscratchcard
googlepaytez phonepe scratch scratchcard swift swiftlibrary
Last synced: 3 months ago
JSON representation
I loved the way payments app's like Google pay and PhonePe used scratch card option to reward it's user. Hence with 💛 cloned the same scratch card effect for you guys out there
- Host: GitHub
- URL: https://github.com/gokulgovind/glscratchcard
- Owner: gokulgovind
- License: mit
- Created: 2019-08-15T02:16:20.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-22T16:23:54.000Z (over 5 years ago)
- Last Synced: 2024-09-15T11:47:14.361Z (10 months ago)
- Topics: googlepaytez, phonepe, scratch, scratchcard, swift, swiftlibrary
- Language: Swift
- Homepage:
- Size: 6.81 MB
- Stars: 85
- Watchers: 6
- Forks: 19
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GLScratchCard
[](https://travis-ci.org/[email protected]/GLScratchCard)
[](https://cocoapods.org/pods/GLScratchCard)
[](https://cocoapods.org/pods/GLScratchCard)
[](https://cocoapods.org/pods/GLScratchCard)

## Example
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Requirements
`GLScratchCard` XCode 10 and Swift 4.2. With deployment target `11.0`.
## Installation
## Cocoapods
`GLScratchCard` is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod 'GLScratchCard'
```
## Manual
Copy the files from ~/Pods/DevelopmentPods/GLScratchCard/ to your project.
## User Guide
### Basic Usage
```swift
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()
```
### Break Down
```swift
let controller = GLScratchCardController()
```### Setting up Components
Titles to be shown initilly, before scratch starts
```swift
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,
```swift
controller.scratchCardView.afterScratchDoneButtonTitle = "Done"
controller.scratchCardView.afterScratchTitle = "Woohoo!"
controller.scratchCardView.afterScratchSubTitle = "Expect payment within a weak."
```Top layer image view,
```swift
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
```### Delegates
1. `GLScratchCardDelegate`
2. `GLScratchCarImageViewDelegate`Add delegates,
```swift
controller.scratchCardView.addDelegate(delegate: self)
controller.scratchCardView.scratchCardImageView.addDelegate(delegate:self)
```#### GLScratchCardDelegate
```swift
func didCloseButtonPressed(sender: UIButton)
func didDoneButtonPressed(sender: UIButton)
```#### GLScratchCarImageViewDelegate
```swift
func scratchpercentageDidChange(value: Float)
func didScratchStarted()
func didScratchEnded()
```
## Author
Gokul, [email protected]
## Social
* [Facebook](https://www.facebook.com/gokul.rockzz.1)
* [Twitter](https://twitter.com/gokulgovind_)
* [StackOverflow](http://stackoverflow.com/users/5582022/gokul?tab=profile)
* [Linkedin](https://www.linkedin.com/in/gokul-govind-1b0232105?trk=nav_responsive_tab_profile)
## License
GLScratchCard is available under the MIT license. See the LICENSE file for more info.