TKUIModePicker

public class TKUIModePicker<Item> : UIView where Item : TKUIModePickerItem

Displays a list of items that the user can toggle on and off.

Call the configure method to set the available items, then attach to rx_pickModes to listen to changes of the user tapping on items.

  • Undocumented

    Declaration

    Swift

    public weak var containerView: UIView?
  • Whether user can enable/disable modes

    Declaration

    Swift

    public var isEnabled: Bool
  • Undocumented

    Declaration

    Swift

    public init()
  • Configures the currently visible items

    Note

    you can call configure multiple times with different sets of items. The mode picker will keep track of which items were previously selected (or not) and maintains that information even if the items are temporarily removed from the configure method’s modes.

    Important

    you must set a desired width for the mode picker before calling this method, otherwise, the number of modes per row will not be calculated properly.

    Declaration

    Swift

    public func configure(all modes: [Item], updateAll: Bool = false, currentlyEnabled: (Item) -> Bool = { _ in true })

    Parameters

    modes

    These are all the available/visible modes

    currentlyEnabled

    Optional handler to check if an item should be enabled; by default all are enabled

Handling tap on mode icons

  • Undocumented

    Declaration

    Swift

    public var rx_pickedModes: Signal<Set<Item>> { get }