@Dependency property wrapper does not compile inside EntityQuery conforming struct #230
Replies: 1 comment 2 replies
-
Hi @twocentstudios, I believe this is because the AppIntents framework already has its own So unfortunately I believe this means you have to do: @Dependencies.Dependency(\.key) var value …when importing AppIntents. I was under the impression that when there are conflicts between a user's code and Apple's libraries that you would be forced to qualify their APIs (e.g. In any case, since this isn't an issue with the library I am going to convert it to a discussion. Please feel free to continue the conversation over there! |
Beta Was this translation helpful? Give feedback.
-
Description
I'm trying to use the
@Dependency
property wrapper within a struct conforming to theEntityQuery
protocol in theAppIntents
framework. Currently I'm trying to define anEntityQuery
in a widget extension.I'm getting a compiler error on the
@Dependency
line in the struct body and within theinit
method:Type of expression is ambiguous without a type annotation
.Checklist
main
branch of this package.Expected behavior
The target compiles and I can use the resolved dependency.
Actual behavior
Compiler error:
Type of expression is ambiguous without a type annotation
(see code below)Steps to reproduce
Widget.swift
fileFor now, I think I can use the below workaround: using
@Dependency
in thedefaultQuery
property of theAppEntity
and passing the results manually into theAppEntityConformingModelQuery
initializer.Related docs for creating a configurable Widget that show minimal
EntityQuery
andAppEntity
definitions: https://developer.apple.com/documentation/widgetkit/making-a-configurable-widgetDependencies version information
main (3815c48) (near 1.3.1)
Destination operating system
iOS 17
Xcode version information
Version 15.4 (15F31d)
Swift Compiler version information
Beta Was this translation helpful? Give feedback.
All reactions