Shortcut
public protocol Shortcut
A type that represents a user workflow, or a part of one, in the Shortcuts app.
-
The type of shortcut representing the body of this shortcut.
When you create a custom shortcut, Swift infers this type from your implementation of the required
bodyproperty.Declaration
Swift
associatedtype Body : Shortcut -
The contents of the shortcut.
Declaration
Swift
var body: Body { get } -
usingResult(named:Extension methoduuid: in: ) Passes the output of this shortcut as a variable that can be referenced in other shortcuts.
Declaration
Swift
public func usingResult<Content>(named name: String? = nil, uuid: UUID = UUID(), @ShortcutBuilder in builder: (Variable) -> Content) -> ResultShortcut<Self, Content> where Content : ShortcutParameters
nameAn optional name to use for the new variable.
uuidAn optional UUID to use for the new variable. Useful for building deterministic output.
builderA closure that is passed the result of the modified shortcut.
Return Value
A modified shortcut that passes its result to the
builderclosure. -
savingOutput(to:Extension method) Saves the output of this shortcut into an output variable that can be referenced in other shortcuts.
Declaration
Swift
public func savingOutput(to outputVariable: OutputVariable) -> SavedOutputShortcut<Self>Parameters
outputVariableAn
OutputVariableinto which the result of this Shortcut will be saved.Return Value
A modified shortcut that saves the result into an output variable.
-
build()Extension methodSerializes the body of the Shortcut to a file format suitable for opening in the Shortcuts app.
Throws
An error of typeEncodingError, if one is thrown during the encoding process.Declaration
Swift
public func build() throws -> DataReturn Value
The binary data representing this Shortcut.
View on GitHub
Shortcut Protocol Reference