subscript(dynamicMember:)
Returns the intent’s output, converted to the inferred type.
Declaration
subscript<T>(dynamicMember keyPath: KeyPath<ResolvedIntentResult.ValueKeyPath, Never>) -> T where T : IntentValueConvertible { get throws }Overview
Access the return value using the value key path, for example:
let result = try await intent.run()
// Compare the result with a concrete value.
XCTAssertEqual(try result.value, "Hello World")If the property’s value isn’t an instance of the type T, this subscript throws an error.
For more information about dynamic-member syntax, see dynamicMemberLookup in The Swift Programming Language.