Variable
public class Variable
extension Variable: CalculationOperandConvertible
extension Variable: ConditionNumberOperandConvertible
extension Variable: ConditionOperandConvertible
extension Variable: ConditionTextOperandConvertible
extension Variable: Equatable
extension Variable: Hashable
extension Variable: Encodable
extension Variable: VariableDateValueConvertible
A variable is a container used to label and store content such as text, images, a webpage, or a dictionary of data.
-
Initializes a variable.
Declaration
Swift
public init(name: String? = nil, uuid: UUID = UUID())
Parameters
name
A custom name for the variable to display in the Shortcuts app.
uuid
The internal UUID of the variable, useful for building deterministic output.
-
A copy of this variable coerced into a Date with the specified date format style.
Declaration
Swift
public func withDateFormat(_ dateFormatStlye: DateFormatStyle) -> Variable
Parameters
dateFormatStlye
The date format.
Return Value
A modified copy of this value.
-
A copy of this variable with the value for a specified property name.
Declaration
Swift
public func withPropertyName(_ propertyName: PropertyName, userInfo: PropertyUserInfo? = nil) -> Variable
Parameters
propertyName
The property name whose value to fetch.
userInfo
Optional user info that depends on the property name.
Return Value
A modified copy of this value.
-
A copy of this variable coerced into a Dictionary with the value for a specified key.
Declaration
Swift
public func withValue(for key: String?) -> Variable
Parameters
key
The key whose value to fetch. If nil, returns the entire dictionary.
Return Value
A modified copy of this value.
-
A copy of this variable coerced into a value of the specified type.
Declaration
Swift
public func withType(_ type: CoercionItemClass) -> Variable
Parameters
type
The new type of the value.
Return Value
A modified copy of this value.
-
Declaration
Swift
public var calculationOperand: CalculationOperand { get }
-
Declaration
Swift
public func hasAnyValue() -> Condition
Return Value
A condition that evaluates to true if this variable has any value.
-
Declaration
Swift
public func doesNotHaveAnyValue() -> Condition
Return Value
A condition that evaluates to true if this variable does not have any value.
-
A number operand that represents this value.
Declaration
Swift
public var conditionNumberOperand: ConditionNumberOperand { get }
-
An operand that represents this value.
Declaration
Swift
public var conditionOperand: ConditionOperand { get }
-
A text operand that represents this value.
Declaration
Swift
public var conditionTextOperand: ConditionTextOperand { get }
-
Returns a Boolean value indicating whether two values are equal.
Declaration
Swift
public static func == (lhs: Variable, rhs: Variable) -> Bool
Parameters
lhs
A value to compare.
rhs
Another value to compare.
Return Value
True if the two values are equal, false otherwise.
-
Hashes the essential components of this value by feeding them into the given hasher.
Declaration
Swift
public func hash(into hasher: inout Hasher)
Parameters
hasher
The hasher to use when combining the components of this instance.
-
Encodes this value into the given encoder.
Throws
This function throws an error if any values are invalid for the given encoder’s format.Declaration
Swift
public func encode(to encoder: Encoder) throws
Parameters
encoder
The encoder to write data to.
-
When the shortcut is run, asks for input from the user.
Declaration
Swift
public class var askEachTime: Variable { get }
-
When the shortcut is run, returns the current clipboard contents.
Declaration
Swift
public class var clipboard: Variable { get }
-
When the shortcut is run, returns the current date.
Declaration
Swift
public class var currentDate: Variable { get }
-
When the shortcut is run, returns the shortcut input from the share sheet or similar.
Declaration
Swift
public class var shortcutInput: Variable { get }
-
A variable date value that represents this value.
Declaration
Swift
public var variableDateValue: VariableValue<Date> { get }