OptionSelector
public protocol OptionSelector
Interface for selecting objects based on index or reference.
-
Type of the options to be able to select.
Declaration
Swift
associatedtype OptionType : Equatable -
Array of options that can be selected.
Declaration
Swift
var options: [OptionType] { get } -
subscript(_:)Default implementationShortcut to get the item at the given index in the array of options.
Default Implementation
Declaration
Swift
subscript(index: Int) -> OptionType { get }Parameters
indexIndex of element to return. Must be within array bounds.
-
Select the given index in the options.
Declaration
Swift
func select(index: Int) -
Select the option in the options array.
Based on the
OptionTypesEquatableimplementation.Declaration
Swift
func select(option: OptionType)Parameters
optionOption to select
-
Deselect the given index in the options.
Declaration
Swift
func deselect(index: Int) -
Deelect the option in the options array.
Based on the
OptionTypesEquatableimplementation.Declaration
Swift
func deselect(option: OptionType)Parameters
optionOption to deselect
-
toggle(index:)Default implementationToggles the selected state of the given index in the options.
Default Implementation
Based on implementation of
isSelected:index,deselect:index, andselect:index.If
isSelected:index, thendeselect:indexis called, otherwiseselect:indexis called.Declaration
Swift
func toggle(index: Int) -
toggle(option:)Default implementationToggle the option in the array.
Based on the
OptionTypesEquatableimplementation.Default Implementation
Based on implementation of
isSelected:option,deselect:option, andselect:option.If
isSelected:option, thendeselect:optionis called, otherwiseselect:optionis called.Declaration
Swift
func toggle(option: OptionType)Parameters
optionOption to toggle
-
Is the given index selected?
Declaration
Swift
func isSelected(index: Int) -> Bool -
Is the given option selected?
Declaration
Swift
func isSelected(option: OptionType) -> Bool
OptionSelector Protocol Reference