Contents

as(_:)

Casts the value to the given type.

Declaration

func `as`<IntentType>(_ type: IntentType) throws -> IntentType.Instance where IntentType : AppIntentTypeDefinition

Discussion

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

let CoffeeEntity = definitions.entities["CoffeeEntity"]
let coffee: AnyAppEntity = try result.value.as(CoffeeEntity)