             return CGSize(width: 36, height: 36)
         }
     }
-	
-	/**
+    
+    /**
      An initializer that initializes the object with a NSCoder object.
      - Parameter aDecoder: A NSCoder instance.
      */
-	public required init?(coder aDecoder: NSCoder) {
-		track = UIView()
-		button = FABButton()
-		super.init(coder: aDecoder)
-		prepare()
-	}
-	
-	/**
+    public required init?(coder aDecoder: NSCoder) {
+        track = UIView()
+        button = FABButton()
+        super.init(coder: aDecoder)
+        prepare()
+    }
+    
+    /**
      An initializer that initializes the object with a CGRect object.
      If AutoLayout is used, it is better to initilize the instance
      using the init(state:style:size:) initializer, or set the CGRect
      to CGRectNull.
      - Parameter frame: A CGRect instance.
      */
-	public override init(frame: CGRect) {
-		track = UIView()
-		button = FABButton()
-		super.init(frame: frame)
-		prepare()
-	}
-	
-	/**
+    public override init(frame: CGRect) {
+        track = UIView()
+        button = FABButton()
+        super.init(frame: frame)
+        prepare()
+    }
+    
+    /**
      An initializer that sets the state, style, and size of the Switch instance.
      - Parameter state: A SwitchState value.
      - Parameter style: A SwitchStyle value.
      - Parameter size: A SwitchSize value.
      */
-	public init(state: SwitchState = .off, style: SwitchStyle = .dark, size: SwitchSize = .medium) {
-		track = UIView()
-		button = FABButton()
-		super.init(frame: .zero)
+    public init(state: SwitchState = .off, style: SwitchStyle = .dark, size: SwitchSize = .medium) {
+        track = UIView()
+        button = FABButton()
+        super.init(frame: .zero)
         prepare()
         prepareSwitchState(state: state)
         prepareSwitchStyle(style: style)
         prepareSwitchSize(size: size)
-	}
-	
+    }
+    
     open override func layoutSubviews() {
         super.layoutSubviews()
         guard willLayout else {


@objc(SwitchStyle)
public enum SwitchStyle: Int {
	case light
	case dark
}

@objc(SwitchState)
public enum SwitchState: Int {
	case on
	case off
}

@objc(SwitchSize)
public enum SwitchSize: Int {
	case small
	case medium
	case large
}

@objc(SwitchDelegate)
public protocol SwitchDelegate {
	/**
     A Switch delegate method for state changes.
     - Parameter control: Switch control.
     - Parameter state: SwitchState value.

    }
    
    /// An internal reference to the switchState public property.
    fileprivate var internalSwitchState = SwitchState.off
    
    /// Track thickness.
    fileprivate var trackThickness: CGFloat = 0
    
    /// Button diameter.
    fileprivate var buttonDiameter: CGFloat = 0
    
    /// Position when in the .on state.
    fileprivate var onPosition: CGFloat = 0
    
    /// Position when in the .off state.
    fileprivate var offPosition: CGFloat = 0
    
    /// The bounce offset when animating.
    fileprivate var bounceOffset: CGFloat = 3
    
    /// An Optional delegation method.
    open weak var delegate: SwitchDelegate?
    
    /// Indicates if the animation should bounce.
    @IBInspectable
    open var isBounceable = true {
        didSet {
            bounceOffset = isBounceable ? 3 : 0
        }
    }
    
    /// Button on color.
    @IBInspectable
    open var buttonOnColor = Color.clear {
        didSet {
            styleForState(state: switchState)
        }
    }
    
    /// Button off color.
    @IBInspectable
    open var buttonOffColor = Color.clear {
        didSet {
            styleForState(state: switchState)
        }
    }
    
    /// Track on color.
    @IBInspectable
    open var trackOnColor = Color.clear {
        didSet {
            styleForState(state: switchState)
        }
    }
    
    /// Track off color.
    @IBInspectable
    open var trackOffColor = Color.clear {
        didSet {
            styleForState(state: switchState)
        }
    }
    
    /// Button on disabled color.
    @IBInspectable
    open var buttonOnDisabledColor = Color.clear {
        didSet {
            styleForState(state: switchState)
        }
    }
    
    /// Track on disabled color.
    @IBInspectable
    open var trackOnDisabledColor = Color.clear {
        didSet {
            styleForState(state: switchState)
        }
    }
    
    /// Button off disabled color.
    @IBInspectable
    open var buttonOffDisabledColor = Color.clear {
        didSet {
            styleForState(state: switchState)
        }
    }
    
    /// Track off disabled color.
    @IBInspectable
    open var trackOffDisabledColor = Color.clear {
        didSet {
            styleForState(state: switchState)
        }
    }
    
    /// Track view reference.
    open fileprivate(set) var track: UIView {
        didSet {
            prepareTrack()
        }
    }
    
    /// Button view reference.
    open fileprivate(set) var button: FABButton {
        didSet {
            prepareButton()
        }
    }
    
    @IBInspectable
    open override var isEnabled: Bool {
        didSet {
            styleForState(state: internalSwitchState)
        }
    }
    
    /// A boolean indicating if the switch is on or not.
    @IBInspectable
    public var isOn: Bool {
        get {
            return .on == internalSwitchState
        }
        set(value) {
            updateSwitchState(state: value ? .on : .off, animated: true, isTriggeredByUserInteraction: false)
        }
    }
    
    /// Switch state.
    open var switchState: SwitchState {
        get {
            return internalSwitchState
        }
        set(value) {
            updateSwitchState(state: value, animated: true, isTriggeredByUserInteraction: false)
        }
    }
    
    /// Switch style.
    open var switchStyle = SwitchStyle.dark {
        didSet {
            switch switchStyle {
            case .light:
                buttonOnColor = Color.blue.darken2
                trackOnColor = Color.blue.lighten3
                buttonOffColor = Color.blueGrey.lighten4
                trackOffColor = Color.grey.lighten3
                buttonOnDisabledColor = Color.grey.lighten2
                trackOnDisabledColor = Color.grey.lighten3
                buttonOffDisabledColor = Color.grey.lighten2
                trackOffDisabledColor = Color.grey.lighten3
            case .dark:
                buttonOnColor = Color.blue.lighten1
                trackOnColor = Color.blue.lighten2.withAlphaComponent(0.5)
                buttonOffColor = Color.grey.lighten3
                trackOffColor = Color.blueGrey.lighten4.withAlphaComponent(0.5)
                buttonOnDisabledColor = Color.grey.darken3
                trackOnDisabledColor = Color.grey.lighten1.withAlphaComponent(0.2)
                buttonOffDisabledColor = Color.grey.darken3
                trackOffDisabledColor = Color.grey.lighten1.withAlphaComponent(0.2)
            }
        }
    }
    
    /// Switch size.
    open var switchSize = SwitchSize.medium {
        didSet {
            switch switchSize {
            case .small:
                trackThickness = 12
                buttonDiameter = 18
            case .medium:
                trackThickness = 18
                buttonDiameter = 24
            case .large:
                trackThickness = 24
                buttonDiameter = 32
            }
            
            frame.size = intrinsicContentSize
        }
    }
    
    open override var intrinsicContentSize: CGSize {
        switch switchSize {
        case .small:
