IntentDefinition file can't be found by a Swift file from my Widget extension

I want to create a configurable widget with dynamic options. So I followed the Apple documentation and everything went fine until I needed to reach the .intentdefinition file.

This is a part of my widget code wich also shows the error.

I did add the .intentdefinition file to the correct targets as mentioned by Apple. For a dynamic widget, you also need to create a Intent Extension. Which I did. If you look to at the screenshot, you'll see that it can reach the .intentdefinition file and doesn't give any errors.

I tried to delete the .intentdefinition file and recreate it, but this didn't make a difference. I also made sure to build the project first when the .intentdefinition file was created.
On the screenshot below, you can see that I added the .intentdefinition file to the corresponding targets.
I hope someone can help me out on this.


Here is a post with the corresponding images.
https://stackoverflow.com/questions/64185405/intentdefinition-file-cant-be-found-by-a-swift-file-from-my-widget-extension

Accepted Reply

I managed to find a solution, I deleted the question on SO because of the downvotes. But if anyone else encounters this issue, this is what I did:

Go to the Build Settings of your widget and intent extension. In both the extensions search for "Intent Class Generation Language" under the "Intent Definition Compiler - Code Generation" section.

Then change it from "Automatic" to "Swift".

Still thanks to the people who tried to help. I hope I can help some people out with this.

Replies

Check answer on SO.
I managed to find a solution, I deleted the question on SO because of the downvotes. But if anyone else encounters this issue, this is what I did:

Go to the Build Settings of your widget and intent extension. In both the extensions search for "Intent Class Generation Language" under the "Intent Definition Compiler - Code Generation" section.

Then change it from "Automatic" to "Swift".

Still thanks to the people who tried to help. I hope I can help some people out with this.