GLScratchCard - Scratch card effect

Overview

GLScratchCard

CI Status

Version

License

Platform

overView

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. To install

it, simply add the following line to your Podfile:

pod 'GLScratchCard'

Manual

Copy the files from ~/Pods/DevelopmentPods/GLScratchCard/ to your project.

User Guide

Basic Usage

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()

sampleGifDPay

Break Down

let controller = GLScratchCardController() 

Setting up Components

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

Delegates

  1. GLScratchCardDelegate
  2. GLScratchCarImageViewDelegate

Add delegates,

controller.scratchCardView.addDelegate(delegate: self)
controller.scratchCardView.scratchCardImageView.addDelegate(delegate:self)

GLScratchCardDelegate

func didCloseButtonPressed(sender: UIButton)
func didDoneButtonPressed(sender: UIButton)

GLScratchCarImageViewDelegate

func scratchpercentageDidChange(value: Float)
func didScratchStarted()
func didScratchEnded()

sampleGifDPay

Author

Gokul, [email protected]

Social

License

GLScratchCard is available under the MIT license. See the LICENSE file for more info.

You might also like...
:star: Custom card-designed CollectionView layout

CardsLayout CardsLayout is a lightweight Collection Layout. Installation CocoaPods You can use CocoaPods to install CardsLayout by adding it to your P

🔥 A multi-directional card swiping library inspired by Tinder
🔥 A multi-directional card swiping library inspired by Tinder

Made with ❤️ by Mac Gallagher Features 💡 Advanced swipe recognition based on velocity and card position 💡 Manual and programmatic actions 💡 Smooth

An iOS library to create beautiful card transitions.
An iOS library to create beautiful card transitions.

CSCardTransition CSCardTransition is a small library allowing you to create wonderful push and pop transition animations like in the App Store. It wor

SimpleCardView-SwiftUI is a very simple card view written with SwiftUI
SimpleCardView-SwiftUI is a very simple card view written with SwiftUI

SimpleCardView-SwiftUI is a very simple card view written with SwiftUI

A custom ImageView that is used to cover the surface of other view like a scratch card, user can swipe the mulch to see the view below.
A custom ImageView that is used to cover the surface of other view like a scratch card, user can swipe the mulch to see the view below.

MCScratchImageView GIF Showcase Requirments iOS 8.0+ Xcode 7.2+ Swift 4.0 Installation CocoaPods pod "MCScratchImageView" Manually Just drag MCScratch

card.io provides fast, easy credit card scanning in mobile apps
card.io provides fast, easy credit card scanning in mobile apps

card.io SDK for iOS card.io provides fast, easy credit card scanning in mobile apps. NEW!!! card.io is now an open-source project! As of December 2014

Swipe able, customizable card stack view, Tinder like card stack view based on UICollectionView. Cards UI
Swipe able, customizable card stack view, Tinder like card stack view based on UICollectionView. Cards UI

Swipable, customizable card stack view, Tinder like card stack view based on UICollectionView. Cards UI Сocoapods installation Add in your Podfile: po

Ios-card-transition - iOS CocoaPod to create beautiful card transitions
Ios-card-transition - iOS CocoaPod to create beautiful card transitions

CSCardTransition CSCardTransition is a small library allowing you to create wond

Card Decks is a small utility application for your iPhone, iPod touch and iPad which brings you simple, configurable, colored, multi-line text cards that are grouped into card decks

Card Decks is a small utility application for your iPhone, iPod touch and iPad which brings you simple, configurable, colored, multi-line text cards that are grouped into card decks.

SwiftUI-Card - Simple card ui designed using SwiftUI
SwiftUI-Card - Simple card ui designed using SwiftUI

SwiftUI - Card Simple card ui designed using SwiftUI Preview

IOS Card Game - A simple card game using SwiftUI
IOS Card Game - A simple card game using SwiftUI

IOS_Card_Game A simple card game using Swift UI.

Appstore card animation transition. UICollectionView and UITableView card expand animated transition
Appstore card animation transition. UICollectionView and UITableView card expand animated transition

Appstore card animation transition. UICollectionView and UITableView card expand animated transition. This library tries to add the appstore transition to your own app. The goal is to be as simple as possible to integrate in an app while keeping the flexibility and customization alive.

Amahi iOS App, new from scratch, in Swift.

Amahi iOS App Amahi iOS App, new from scratch, in Swift. master beta Requirements iOS 9.0+ Xcode 9.0+ Setup Close Xcode Open a terminal window, and $

Don't start from scratch, start from Here! This is a starter project for iOS projects. It contains all the basic configurations and common libraries for your project.

Starter-iOS Don't start from scratch, start from Here! This is a starter project for iOS projects. It contains all the basic configurations and common

Build a workout app from scratch using SwiftUI and HealthKit
Build a workout app from scratch using SwiftUI and HealthKit

Build a workout app for Apple Watch Build a workout app from scratch using SwiftUI and HealthKit during this code along. Learn how to support the Alwa

Create a weather app from scratch with this SwiftUI Crash Course
Create a weather app from scratch with this SwiftUI Crash Course

"Create a weather app from scratch with this SwiftUI Crash Course" https://youtu

CalendarApp Swift - Made a calendar app in swift, completely from scratch using UIStackView and UICollectionView
CalendarApp Swift - Made a calendar app in swift, completely from scratch using UIStackView and UICollectionView

CalendarApp_Swift Made a calendar app in swift, completely from scratch using UI

Ios-desde-cero - Code, documents and resources used in the Stream iOS from scratch
Ios-desde-cero - Code, documents and resources used in the Stream iOS from scratch

iOS desde cero ¿Qué es esto? iOS desde Cero es un Streaming en 🇪🇸 sobre desarr

Comments
  • Application crash at large scale of scratchCardView

    Application crash at large scale of scratchCardView

    Application crash at large scale of scratchCardView on line -pixelData[y * width + x] == 0 (Thread 1: EXC_BAD_ACCESS (code=1, address=0x7fab776e0000)). The number of loop iterations in this function is about 200498 (it's too much). Yes, I understand that GLScratchCard was not intended for such purposes (the size of the erasable image is too large). The problem was observed only in some cases on the iPad, where the image size was calculated from the size of the device. The solution helped - to reduce the size of the image.

    Thank you very much for your library - it's very cool and I liked it!

    opened by Vitaly-Ku 0
  • Scratching image speed too slow

    Scratching image speed too slow

    I added the required code from GitHub but scratching image speed is too slow in the simulator. Maybe simulator issue but still need to check. Please check and help

    opened by kvikas063 0
Owner
Gokul
Project Specialist iOS
Gokul
IOS Card Game - A simple card game using SwiftUI

IOS_Card_Game A simple card game using Swift UI.

Md. Masum Musfique 1 Mar 25, 2022
A reactive, card-based UI framework built on UIKit for iOS developers.

CardParts - made with ❤️ by Intuit: Example Requirements Installation Communication & Contribution Overview Quick Start Architecture CardsViewControll

Intuit 2.5k Jan 4, 2023
A SwiftUI based custom sheet card to show information in iOS application.

A SwiftUI based custom sheet card to show any custom view inside the card in iOS application.

Mahmud Ahsan 4 Mar 28, 2022
A SwiftUI card view, made great for setup interactions.

SlideOverCard A SwiftUI card design, similar to the one used by Apple in HomeKit, AirPods, Apple Card and AirTag setup, NFC scanning, Wi-Fi password s

João Gabriel 716 Dec 29, 2022
This UI attempts to capture the Quibi Card Stack and the associated User Interaction.

RGStack This UI attempts to capture the Quibi Card Stack and the associated User Interaction. Required A View that conforms to the ConfigurableCard pr

RGeleta 96 Dec 18, 2022
Card-based view controller for apps that display content cards with accompanying maps, similar to Apple Maps.

TripGo Card View Controller This is a repo for providing the card-based design for TripGo as well as the TripKitUI SDK by SkedGo. Specs 1. Basic funct

SkedGo 6 Oct 15, 2022
Card flip animation by pan gesture.

CardAnimation Design from Dribble. 实现思路在这里。 Two Solutions At the begin, I didn't encapsulate code, @luxorules refactor code into class and improve it

null 1.2k Dec 14, 2022
Awesome looking Dial like card selection ViewController

KVCardSelectionVC Awesome looking Dial like card selection ViewController An updated Swift 3 working version of : https://github.com/atljeremy/JFCardS

Kunal Verma 23 Feb 1, 2021
🃏 Tinder like card interface

Features Swift 3 Custom views for the card & overlay Generic Dynamically add new cards on top or on the bottom Lazy view loading Setup pod 'DMSwipeCar

Dylan Marriott 250 Nov 15, 2022
Cusom CollectionView card layout

MMCardView Example To run the example project, clone the repo, and run pod install from the Example directory first. Demo 1.Card Requirements iOS 8.0+

Millman Yang 556 Dec 5, 2022