Action

struct Action
extension Action : Copyable, CustomStringConvertible, Equatable, Escapable, Hashable, Identifiable, Node, Sendable

Base struct for all Actions in the automation graph.

  • id

    The stable identity of the entity associated with this instance.

    Declaration

    Swift

    let id: String
  • The unique ID for the entity associated with the Action.

    Declaration

    Swift

    let entity: any HomeObject
  • For device entities, the identifier of the DeviceType associated with the action.

    Declaration

    Swift

    let deviceType: (any DeviceType.Type)?
  • For device entities, the string-based identifier for the DeviceType. If the deviceType is UnknownDeviceType it will refer to the original DeviceType ID provided.

    Declaration

    Swift

    let deviceTypeID: String?
  • The behavior to take when the Action is executed.

    Declaration

    Swift

    let behavior: any ActionBehavior
  • Returns a Boolean value indicating whether two values are equal.

    Equality is the inverse of inequality. For any values a and b, a == b implies that a != b is false.

    Declaration

    Swift

    static func == (lhs: Action, rhs: Action) -> Bool

    Parameters

    lhs

    A value to compare.

    rhs

    Another value to compare.

  • Returns true if the nodes are equal, false otherwise.

    Declaration

    Swift

    func isEqual(to other: any Node) -> Bool
  • A textual representation of this instance.

    Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the String(describing:) initializer. This initializer works with any type, and uses the custom description property for types that conform to CustomStringConvertible:

    struct Point: CustomStringConvertible {
        let x: Int, y: Int
    
        var description: String {
            return "(\(x), \(y))"
        }
    }
    
    let p = Point(x: 21, y: 30)
    let s = String(describing: p)
    print(s)
    // Prints "(21, 30)"
    

    The conversion of p to a string in the assignment to s uses the Point type’s description property.

    Declaration

    Swift

    var description: String { get }