Contents

as(_:)

Casts a property to the provided type.

Declaration

func `as`<T>(_ type: T.Type) throws -> T where T : IntentValueConvertible

Discussion

If the value’s type doesn’t match, this method throws an error.

let result = try await intent.run()
try result.value.as(String.self) == "My Name"