StreamDeckPlugin

public final class StreamDeckPlugin

An object that manages a plugins’s main event loop.

  • The shared plugin.

    Declaration

    Swift

    public static var shared: StreamDeckPlugin!
  • The plugin’s delegate object.

    Declaration

    Swift

    public let plugin: any PluginDelegate
  • Instances of actions.

    Declaration

    Swift

    public private(set) var instances: [String : any Action] { get }

Streamdeck Properties

  • The port that should be used to create the WebSocket

    Declaration

    Swift

    public let port: Int32
  • A unique identifier string that should be used to register the plugin once the WebSocket is opened.

    Declaration

    Swift

    public let uuid: String
  • The event type that should be used to register the plugin once the WebSocket is opened

    Declaration

    Swift

    public let event: String
  • The Stream Deck application information and devices information.

    Declaration

    Swift

    public let info: PluginRegistrationInfo

InstanceManager

  • Look up the action type based on the UUID.

    Declaration

    Swift

    public func action(forID uuid: String) -> (any Action.Type)?

    Parameters

    uuid

    The UUID of the action.

    Return Value

    The action’s type, if available.

  • Register a new instance of an action from a willAppear event.

    Declaration

    Swift

    public func registerInstance(actionID: String, context: String, coordinates: Coordinates?)

    Parameters

    event

    The event with information about the instance.

  • Remove an instance of an action from a willDisappear event.

    Declaration

    Swift

    public func removeInstance(_ context: String?)

    Parameters

    event

    The event with information about the instance.

  • Return an action by its context.

    Declaration

    Swift

    public subscript(context: String) -> (any Action)? { get }
  • Declaration

    Swift

    public subscript(context: String?) -> (any Action)? { get }

Helper Functions

  • Send raw events over the the socket.

    Throws

    Errors while encoding the data to JSON.

    Declaration

    Swift

    public func sendEvent(_ eventType: SendableEventKey, action: String? = nil, context: String?, payload: [String : Any]?)

    Parameters

    eventType

    The event type.

    context

    The context token.

    payload

    The payload for the action.

  • Send raw events over the the socket.

    Throws

    Errors while encoding the data to JSON.

    Declaration

    Swift

    public func sendEvent<P>(_ eventType: SendableEventKey, action: String? = nil, context: String?, payload: P?) where P : Encodable

    Parameters

    eventType

    The event type.

    context

    The context token.

    payload

    The payload for the action.