IntentValueConvertibleWrapper
A protocol for types that wrap another intent value that supports conversion.
Declaration
protocol IntentValueConvertibleWrapper : IntentValueConvertibleOverview
IntentValueConvertibleWrapper enables you to create specialized types that derive their IntentValueConvertible conformance from an underlying base type. This pattern allows you to extend existing convertible types with additional functionality while preserving their ability to work within the AppIntents framework.
Use this protocol when you want to create a type that:
Wraps an existing
IntentValueConvertibletypeAdds domain-specific properties or methods
Maintains compatibility with the AppIntents framework
Example
struct LandmarkEntity: IntentValueConvertibleWrapper {
var baseValue: AnyAppEntity
init(baseValue: AnyAppEntity) {
self.baseValue = baseValue
}
var continent: String {
get throws {
try baseValue.continent
}
}
}