Scratchcard effect

To achieve scratchcard effect you have to options ScratchCardTouchContainer or ScratchCardImageView example

###ScratchCardTouchContainer

A simple UIView subclass that allows tracking touch events already outside your UIImageView that represents your scratchcard. Just simple pass reference to your scratchcard image view.

Example:

scratchCardTouchContainer.scratchCardImageView = scratchCard
scratchCardTouchContainer.lineType = .square
scratchCardTouchContainer.lineWidth = 20 

ScratchCardImageView

A simple UIImageView subclass that allows your UIImageView become a scratchcard. Touch events will be tracked only inside the UIImageView bounds. In the storyboard or xib set custom class of your UIImageView that represents your scratchcard image to ScratchCardImageView

For both classes you can set delegate to retrieve erase progress from 0 (not erased) to 1 (fully erased).

License

ScratchCardImageView and ScratchCardTouchContainer is released under an MIT License. See LICENSE for details.