pgorzelany / ScratchCardView

A scratch card view for iOS
MIT License
311 stars 26 forks source link

Not working using basic sample #1

Closed talkaboutdesign closed 7 years ago

talkaboutdesign commented 7 years ago

`import UIKit import ScratchCardView

class ViewController: UIViewController {

@IBOutlet weak var scratchCardView: ScratchCardView!

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

     configureScratchCardView()

}

private func configureScratchCardView() {
    scratchCardView.delegate = self
    scratchCardView.scratchWidth = 150

}

}

extension ViewController: ScratchCardViewDelegate {

func coverView(for scratchCardView: ScratchCardView) -> UIView {
    let coverView = UIView()
    coverView.backgroundColor = UIColor.gray
    return coverView
}

func contentView(for scratchCardView: ScratchCardView) -> UIView {
    let imageView = UIImageView(image: #imageLiteral(resourceName: "tailor-image"))
    imageView.contentMode = .scaleAspectFill
    return imageView
}

}`

Nothing scratching off.

pgorzelany commented 7 years ago

Hi @talkaboutdesign.

What Xcode version did you use? Did you try the basic example in the project? There where some problems when using Xcode9 but I pushed some fixes for that. Try release 1.2.0

talkaboutdesign commented 7 years ago

Works. But changing strokeWidth is not reflected.

pgorzelany commented 7 years ago

@talkaboutdesign the scratch width should be fixed in 1.3.0 Let me know if everything works so I will close the issue.

talkaboutdesign commented 7 years ago

Thank you. Was wondering about s few more things.

Is there an easy way to clear the mask? Is there a way to get amount on screen scratched off? Like 40% etc?

pgorzelany commented 7 years ago

@talkaboutdesign the functionality you mentioned does not exist currently but I if you open a feature request I can add them.