InterfaceAction

public struct InterfaceAction<UserInteractionType, DestinationType, ContentType> : Equatable, Hashable where UserInteractionType : UserInteractionTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable

Represents an action to be taken when a user interacts with a particular interface element.

  • id

    A unique identifier.

    Declaration

    Swift

    public let id: UUID
  • A closure to be run when a user interacts with a specific user interface element.

    Declaration

    Swift

    public var function: (UserInteractionType, InterfaceActionData<DestinationType, ContentType>) -> Void
  • A user interaction type.

    Declaration

    Swift

    public var userInteractionType: UserInteractionType?
  • Model data associated with the presentation which is used by the closure.

    Declaration

    Swift

    public var data: InterfaceActionData<DestinationType, ContentType>
  • Calls the closure.

    Note

    This is a “magic” function used by Swift, as part of Swift proposal SE-0253. See https://github.com/swiftlang/swift-evolution/blob/main/proposals/0253-callable.md for more information.

    Declaration

    Swift

    public func callAsFunction()
  • The initializer.

    Declaration

    Swift

    public init(function: @escaping (UserInteractionType, InterfaceActionData<DestinationType, ContentType>) -> Void, interactionType: UserInteractionType? = nil, data: InterfaceActionData<DestinationType, ContentType>? = nil)

    Parameters

    function

    A closure to be run when a user interacts with a specific user interface element.

    interactionType

    A user interaction type.

    data

    Model data associated with the presentation which is used by the closure.

  • Declaration

    Swift

    public static func == (lhs: InterfaceAction, rhs: InterfaceAction) -> Bool
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)