         }
     }
     
-    @IBInspectable public var strokeColor: UIColor = UIColor.blackColor() {
+    @IBInspectable public var strokeColor: UIColor = UIColor.black() {
         didSet {
             self.strokeColor.setStroke()
         }
     }
     
-    @IBInspectable public var signatureBackgroundColor: UIColor = UIColor.whiteColor() {
+    @IBInspectable public var signatureBackgroundColor: UIColor = UIColor.white() {
         didSet {
             self.backgroundColor = signatureBackgroundColor
         }
     }
     
     // Computed Property returns true if the view actually contains a signature
-    public var containsSignature: Bool {
+    public var doesContainSignature: Bool {
         get {
-            if self.path.empty {
+            if self.path.isEmpty {
                 return false
             } else {
                 return true

        
        self.backgroundColor = self.signatureBackgroundColor
        self.path.lineWidth = self.strokeWidth
        self.path.lineJoinStyle = CGLineJoin.Round
    }
    
    // MARK: - Draw
    override public func drawRect(rect: CGRect) {
        self.strokeColor.setStroke()
        self.path.stroke()
    }
    
    // MARK: - Touch handling functions
    override public func touchesBegan(touches: Set <UITouch>, withEvent event: UIEvent?) {
        if let firstTouch = touches.first {
            let touchPoint = firstTouch.locationInView(self)
            self.ctr = 0
            self.pts[0] = touchPoint
        }
        
        if let delegate = self.delegate {
            delegate.startedSignatureDrawing!()
        }
    }
    
    override public func touchesMoved(touches: Set <UITouch>, withEvent event: UIEvent?) {
        if let firstTouch = touches.first {
            let touchPoint = firstTouch.locationInView(self)
            self.ctr += 1
            self.pts[self.ctr] = touchPoint
            if (self.ctr == 4) {
                self.pts[3] = CGPointMake((self.pts[2].x + self.pts[4].x)/2.0, (self.pts[2].y + self.pts[4].y)/2.0)
                self.path.moveToPoint(self.pts[0])
                self.path.addCurveToPoint(self.pts[3], controlPoint1:self.pts[1], controlPoint2:self.pts[2])
                
                self.setNeedsDisplay()
                self.pts[0] = self.pts[3]
                self.pts[1] = self.pts[4]
                self.ctr = 1
            }
            
            self.setNeedsDisplay()
        }
    }
    
    override public func touchesEnded(touches: Set <UITouch>, withEvent event: UIEvent?) {
        if self.ctr == 0 {
            let touchPoint = self.pts[0]
            self.path.moveToPoint(CGPointMake(touchPoint.x-1.0,touchPoint.y))
            self.path.addLineToPoint(CGPointMake(touchPoint.x+1.0,touchPoint.y))
            self.setNeedsDisplay()
        } else {
            self.ctr = 0
        }
        
        if let delegate = self.delegate {
            delegate.finishedSignatureDrawing!()
        }
    }
    
    // MARK: - Methods for interacting with Signature View
    
    // Clear the Signature View
    public func clearSignature() {
        self.path.removeAllPoints()
        self.setNeedsDisplay()
    }
    
    // Save the Signature as an UIImage
    public func getSignature(scale scale:CGFloat = 1) -> UIImage? {
        if !containsSignature { return nil }
        UIGraphicsBeginImageContextWithOptions(self.bounds.size, false, scale)
        self.path.stroke()
        let signature = UIGraphicsGetImageFromCurrentImageContext()

// YPDrawSignatureView is open source
// Version 0.2.0
//
// Copyright (c) 2014 - 2016 Yuppielabel and the project contributors
// Available under the MIT license
