     }
     
     override public init(frame: CGRect) {
-        let initialFrame = CGRectIsEmpty(frame) ? defaultFrame : frame
+        let initialFrame = frame.isEmpty ? defaultFrame : frame
         super.init(frame: initialFrame)
         
         self.setup()

     */
    public func setOn(isOn: Bool, animated: Bool) {
        switchValue = isOn
        
        if on {
            showOn(animated)
        }
        else {
            showOff(animated)
        }
    }
    
    /**
     *   Detects whether the switch is on or off
     *
     *	 @return	Bool true if switch is on, false otherwise
     */
    public func isOn() -> Bool {
        return on
    }
    
    // MARK: - Private methods -

    /**
     *   Updates the looks of the switch to be in the on position
     *   optionally make it animated
     */
    private func showOn(animated: Bool) {
        thumbView.endTracking(true)

        UIView.animateWithDuration(animationDuration, delay: 0.0, options: [UIViewAnimationOptions.CurveEaseIn, UIViewAnimationOptions.BeginFromCurrentState], animations: {
            self.thumbView.frame = CGRectOffset(self.originalThumbRect, self.maxThumbOffset, 0)
        }, completion: nil)
    }
    
    /**

    private var maxThumbOffset: CGFloat {
        return self.bounds.width - thumbView.frame.width - borderMargin * 2
    }
    
    private var originalThumbRect: CGRect {
        let squareRect = CGRect(x: 0, y: 0, width: self.bounds.height, height: self.bounds.height)
        return squareRect.inset(by: UIEdgeInsets(top: borderMargin, left: borderMargin, bottom: borderMargin, right: borderMargin))
    }
    
    
    // MARK: - Lifecycle -
    /**
