iOS AppIntents "Unable to determine value type for type" when AppEnum belongs to Swift Package

Sorry if I'm in the wrong category for this :pray:
Please see this MRE for clarity:

(I used the example code from Dive into App Intents - WWDC22 - Videos - Apple Developer except for deprecation warnings)

The compiler throws an error Unable to determine value type for type IntentPackage.Shelf.

According to comments in this question it's because the type I'm extending to AppEnum is not in the app target's module, but in a Swift Package.
I really don't like having to duplicate the types just to make it work and was wondering if I'm missing something.

Theoretically, this question would be better asked in the Apple Developer Forums.

It does seem that moving your Shelf type into the main project solves the issue. I wonder if maybe a macro would solve your duplication issue?

@mgorbach may have a workaround or answer.

Thank you @Diggory

It does seem that moving your Shelf type into the main project solves the issue.

Exactly. That would solve it, but I'd really prefer a cleaner way if there is one.
(Usually I'm just making a mistake somewhere, so I wanted to check.)

Thank you for the reference!

I ran your project and had the same. I experimented with moving OpenShelf into the package and building. But then the intent would no longer work. I suspect this is all expected and agree moving your Shelf type is the way to resolve.

1 Like

Thank you.
I'm just a bit confused by the existence of AppIntentsPackage | Apple Developer Documentation then, because this would mean there are AppEnums in other packages anyway...

That is odd...

I tried putting your Shelf type in the external Package inside a type that conformed to AppIntentsPackage then in the main app defining a type that conforms to AppIntentsPackage and gave it an includedPackages property that listed that IntentsPackage from the external package, but the compiler still complained about 'Unable to determine value type for type '.

Googling for that specific error yields very few results, all about the same issue (which are either your posts, or the SO post that you linked above.)

I'd file a Radar maybe?

1 Like

Thank you for checking this out. I'm somewhat relieved that you seem to get stuck at the same issue, let me file a radar about it!