Created
April 8, 2017 11:26
-
-
Save helloworldsmart/f83a7e73e211b829d045ae0b922a65b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FaceView: UIView { | |
| //MARK | |
| //Don't type infer | |
| @IBInspectable | |
| var scale: CGFloat = 0.9 { didSet{setNeedsDisplay()} } | |
| @IBInspectable | |
| var eyesOpen: Bool = true { didSet{setNeedsDisplay()} } | |
| @IBInspectable | |
| var mouthCurvature: Double = 1.0 { didSet{setNeedsDisplay()} } | |
| @IBInspectable | |
| var lineWidth: CGFloat = 5.0 { didSet{setNeedsDisplay()} } | |
| @IBInspectable | |
| var color: UIColor = UIColor.blue { didSet{setNeedsDisplay()} } | |
| //MARK | |
| func changeScale(byReactingTo pinchRecognizer: UIPinchGestureRecognizer) | |
| { | |
| switch pinchRecognizer.state { | |
| case .changed, .ended: | |
| scale *= pinchRecognizer.scale | |
| pinchRecognizer.scale = 1 | |
| default: | |
| break | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment