fixed bug in toggle being out of sync with isSelected
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
edcaadf274
commit
bd96705b4e
@ -130,7 +130,15 @@ open class ToggleBase: Control, Accessable, DataTrackable, BinaryColorable {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Properties
|
||||
//--------------------------------------------------
|
||||
open var isOn: Bool = false { didSet { didChange() }}
|
||||
open var isOn: Bool {
|
||||
get { isSelected }
|
||||
set {
|
||||
if isSelected != newValue {
|
||||
isSelected = newValue
|
||||
}
|
||||
didChange()
|
||||
}
|
||||
}
|
||||
|
||||
open var isAnimated: Bool = true { didSet { didChange() }}
|
||||
|
||||
@ -292,7 +300,6 @@ open class ToggleBase: Control, Accessable, DataTrackable, BinaryColorable {
|
||||
public override func reset() {
|
||||
super.reset()
|
||||
label.reset()
|
||||
isSelected = false
|
||||
isOn = false
|
||||
|
||||
isAnimated = true
|
||||
@ -313,7 +320,6 @@ open class ToggleBase: Control, Accessable, DataTrackable, BinaryColorable {
|
||||
/// This will toggle the state of the Toggle and execute the actionBlock if provided.
|
||||
open func toggle() {
|
||||
isOn.toggle()
|
||||
isSelected = isOn
|
||||
sendActions(for: .valueChanged)
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user