updated protocol
This commit is contained in:
parent
2b378f5597
commit
f27e3cd680
@ -71,14 +71,6 @@
|
||||
|
||||
public func formFieldValue() -> AnyHashable? { selected }
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Selectable Protocol
|
||||
//--------------------------------------------------
|
||||
|
||||
public func select(as isSelected: Bool) {
|
||||
selected = isSelected
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializer
|
||||
//--------------------------------------------------
|
||||
|
||||
@ -58,14 +58,6 @@ public class ToggleModel: NSObject, MoleculeModelProtocol, FormFieldProtocol, En
|
||||
|
||||
public func formFieldValue() -> AnyHashable? { selected }
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Selectable Protocol
|
||||
//--------------------------------------------------
|
||||
|
||||
public func select(as isSelected: Bool) {
|
||||
selected = isSelected
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializer
|
||||
//--------------------------------------------------
|
||||
|
||||
@ -8,10 +8,9 @@
|
||||
|
||||
/// Protocol to apply to any model of a UI Control with a binary on/off nature.
|
||||
///
|
||||
/// Example classes: Checkbox or Switch.
|
||||
/// Example classes: Checkbox or Toggle.
|
||||
@objc public protocol SelectableMoleculeModel: AnyObject {
|
||||
@objc dynamic var selected: Bool { get set }
|
||||
func select(as isSelected: Bool)
|
||||
}
|
||||
|
||||
public class SelectAllBoxesBehaviorModel: PageBehaviorModelProtocol {
|
||||
@ -148,7 +147,7 @@ public class SelectAllBoxesBehavior: PageCustomActionHandlerBehavior, PageMolecu
|
||||
// Iterate through selectable molecules.
|
||||
for selectableModel in selectableModels {
|
||||
if toSelect(model: selectableModel) || toDeselect(model: selectableModel) {
|
||||
selectableModel.select(as: didSelectAllState)
|
||||
selectableModel.selected = didSelectAllState
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user