Skip to content

Instantly share code, notes, and snippets.

@helloworldsmart
Created April 8, 2017 11:26
Show Gist options
  • Select an option

  • Save helloworldsmart/f83a7e73e211b829d045ae0b922a65b2 to your computer and use it in GitHub Desktop.

Select an option

Save helloworldsmart/f83a7e73e211b829d045ae0b922a65b2 to your computer and use it in GitHub Desktop.
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