FUIStateTintable

public protocol FUIStateTintable : AnyObject

The protocol denotes that the component could have different tint colors for different tint states. Typically not used by developer.

  • The control state.

    Declaration

    Swift

    var state: UIControlState { get }
  • This function is invoked after a state is changed.

    Declaration

    Swift

    func stateDidChange()
  • The tint color for the current control state.

    Declaration

    Swift

    var tintColor: UIColor! { get set }
  • Sets the tint color for the specified control state.

    Declaration

    Swift

    func setTintColor(_ color: UIColor, for state: UIControlState)

    Parameters

    color

    The tint color to be set.

    state

    The state for the tint color to be set.

  • Gets the tint color for the specified control state.

    Declaration

    Swift

    func tintColor(for state: UIControlState) -> UIColor?

    Parameters

    state

    The specified control state.

  • stateDidChange() Default implementation

    Default Implementation

    Should be invoked by controls, when state is changed. Technique for doing this may vary. Controls are responsible for invoking correclty.

    Declaration

    Swift

    public func stateDidChange()
  • tintColor(for:) Default implementation

    Default Implementation

    Public getter to read tint color from backing dictionary

    Declaration

    Swift

    public func tintColor(for state: UIControlState) -> UIColor?

    Parameters

    state

    state for which tintColor is needed

    Return Value

    if not .normal state, reads from backing dictionary. If .normal, returns self.tintColor. (This solves the issue, where an unset tintColor should return color from super.

  • state Default implementation

    Default Implementation

    Tintable state as UIControlState

    Declaration

    Swift

    public var state: UIControlState { get }