TKUICardAction

open class TKUICardAction<Card, Model> where Card : TGCard

An action that can be added to a TKUI<*>Card. An array of these actions is typically generated by a factory method in a card’s configuration property, e.g., TKUITripOverviewCard.config.tripActionsFactory or TKUIServiceCard.config.serviceActionsFactory

For a concerte example, see TKUIStartTripAction.

  • Declaration

    Swift

    public init(
      title: String,
      icon: UIImage,
      style: TKUICardActionStyle = .normal,
      handler: @escaping (TKUICardAction<Card, Model>, Card, Model, UIView) -> Bool
    )
  • Title (and accessory label) of the button

    Declaration

    Swift

    open var title: String
  • Icon to display as the action. Should be a template image.

    Declaration

    Swift

    open var icon: UIImage
  • Declaration

    Swift

    open var style: TKUICardActionStyle
  • Handler executed when user taps on the button, providing the corresponding card and model instance. Should return whether the button should be refreshed as its title or icon changed as a result (e.g., for toggle actions such as adding or removing a reminder or favourite).

    Parameters are the card, the model instance, and the sender

    Declaration

    Swift

    public let handler: (TKUICardAction<Card, Model>, Card, Model, UIView) -> Bool