SwipeAction

public class SwipeAction: NSObject

The SwipeAction object defines a single action to present when the user swipes horizontally in a table/collection item.

This class lets you define one or more custom actions to display for a given item in your table/collection. Each instance of this class represents a single action to perform and includes the text, formatting information, and behavior for the corresponding button.

  • An optional unique action identifier.

    Declaration

    Swift

    public var identifier: String?
  • The title of the action button.

    Note

    You must specify a title or an image.

    Declaration

    Swift

    public var title: String?
  • The style applied to the action button.

    Declaration

    Swift

    public var style: SwipeActionStyle
  • The object that is notified as transitioning occurs.

    Declaration

    Swift

    public var transitionDelegate: SwipeActionTransitioning?
  • The font to use for the title of the action button.

    Note

    If you do not specify a font, a 15pt system font is used.

    Declaration

    Swift

    public var font: UIFont?
  • The text color of the action button.

    Note

    If you do not specify a color, white is used.

    Declaration

    Swift

    public var textColor: UIColor?
  • The highlighted text color of the action button.

    Note

    If you do not specify a color, textColor is used.

    Declaration

    Swift

    public var highlightedTextColor: UIColor?
  • The image used for the action button.

    Note

    You must specify a title or an image.

    Declaration

    Swift

    public var image: UIImage?
  • The highlighted image used for the action button.

    Note

    If you do not specify a highlight image, the default image is used for the highlighted state.

    Declaration

    Swift

    public var highlightedImage: UIImage?
  • The closure to execute when the user taps the button associated with this action.

    Declaration

    Swift

    public var handler: ((SwipeAction, IndexPath) -> Void)?
  • The background color of the action button.

    Note

    Use this property to specify the background color for your button. If you do not specify a value for this property, the framework assigns a default color based on the value in the style property.

    Declaration

    Swift

    public var backgroundColor: UIColor?
  • The highlighted background color of the action button.

    Note

    Use this property to specify the highlighted background color for your button.

    Declaration

    Swift

    public var highlightedBackgroundColor: UIColor?
  • The visual effect to apply to the action button.

    Note

    Assigning a visual effect object to this property adds that effect to the background of the action button.

    Declaration

    Swift

    public var backgroundEffect: UIVisualEffect?
  • A Boolean value that determines whether the actions menu is automatically hidden upon selection.

    Note

    When set to true, the actions menu is automatically hidden when the action is selected. The default value is false.

    Declaration

    Swift

    public var hidesWhenSelected = false
  • Constructs a new SwipeAction instance.

    Declaration

    Swift

    public init(style: SwipeActionStyle, title: String?, handler: ((SwipeAction, IndexPath) -> Void)?)

    Parameters

    style

    The style of the action button.

    title

    The title of the action button.

    handler

    The closure to execute when the user taps the button associated with this action.

  • Calling this method performs the configured expansion completion animation including deletion, if necessary. Calling this method more than once has no effect.

    You should only call this method from the implementation of your action handler method.

    Declaration

    Swift

    public func fulfill(with style: ExpansionFulfillmentStyle)

    Parameters

    style

    The desired style for completing the expansion action.