the latest switch.
This commit is contained in:
parent
1668fb8c32
commit
dd47707064
@ -11,7 +11,12 @@ import UIKit
|
||||
|
||||
public typealias ValueChangeBlock = () -> ()
|
||||
|
||||
|
||||
/**
|
||||
A custom implementation of Apple's UISwitch.
|
||||
|
||||
Track: The background of the switch control.
|
||||
Thumb: The circular indicator that slides on the track.
|
||||
*/
|
||||
@objcMembers open class Switch: Control, MVMCoreUIViewConstrainingProtocol, FormValidationFormFieldProtocol {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
@ -21,10 +26,14 @@ public typealias ValueChangeBlock = () -> ()
|
||||
public var thumbTintColor: (on: UIColor?, off: UIColor?)? = (on: .white, off: .white)
|
||||
public var disabledTintColor: (track: UIColor?, thumb: UIColor?)? = (track: .mfSilver(), thumb: .white)
|
||||
|
||||
var shouldTouchToSwitch = false
|
||||
var valueChangedBlock: ValueChangeBlock?
|
||||
var actionBlock: ValueChangeBlock?
|
||||
private var valueShouldChange = false
|
||||
private var canChangeValue = false
|
||||
private var shouldTouchToSwitch = false
|
||||
|
||||
private var valueChangedBlock: ValueChangeBlock?
|
||||
private var actionBlock: ValueChangeBlock?
|
||||
|
||||
// Sizes are from InVision design specs.
|
||||
static let trackSize = CGSize(width: 46, height: 24)
|
||||
static let thumbSize = CGSize(width: 22, height: 22)
|
||||
|
||||
@ -32,9 +41,6 @@ public typealias ValueChangeBlock = () -> ()
|
||||
|
||||
private var thumbView = View()
|
||||
|
||||
private var valueShouldChange = false
|
||||
private var canChangeValue = false
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Computed Properties
|
||||
//--------------------------------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user