EDIT: I think maybe I wasn't seeing files get rebuilt properly because I managed to get it working!
The 'U' references are not necessarily going to cause link issues. Using "nm -m" I can see that the single remaining 'U' when I do include Joe's workaround is for a "weak external" symbol which, presumably, will not cause a link failure:
(undefined) weak external _$s9WidgetKit22IntentTimelineProviderP15recommendationsSayAA0C14RecommendationVy0C0QzGGyFTq (from WidgetKit)
When I don't include the workaround the other 'U' reference is not weak:
(undefined) external _$s9WidgetKit22IntentTimelineProviderPAAE15recommendationsSayAA0C14RecommendationVy0C0QzGGyF (from WidgetKit)
ORIGINAL COMMENT BELOW:
Joe's solution isn't working for me. I did some investigation to try and work out where the undefined symbol is coming from. If I don't use his workaround, when I use the 'nm' command to look for symbols containing the word "recommendations" in the built widget .appex file I see this:
Villanelle:AdaptivityWidget14Extension.appex geoff$ nm AdaptivityWidget14Extension | grep recommendations
000000010003ff94 t _$s27AdaptivityWidget14Extension22LayoutTimelineProviderV9WidgetKit06IntenteF0AadEP15recommendationsSayAD0I14RecommendationVy0I0QzGGyFTW
00000001000173f4 t _$s27AdaptivityWidget14Extension27DynamicTypeTimelineProviderV9WidgetKit06IntentfG0AadEP15recommendationsSayAD0J14RecommendationVy0J0QzGGyFTW
00000001000292fc t _$s27AdaptivityWidget14Extension27SystemImageTimelineProviderV9WidgetKit06IntentfG0AadEP15recommendationsSayAD0J14RecommendationVy0J0QzGGyFTW
0000000100033b68 t _$s27AdaptivityWidget14Extension28SystemImagesTimelineProviderV9WidgetKit06IntentfG0AadEP15recommendationsSayAD0J14RecommendationVy0J0QzGGyFTW
000000010002c498 t _$s27AdaptivityWidget14Extension32LockScreenLayoutTimelineProviderV9WidgetKit06IntentgH0AadEP15recommendationsSayAD0K14RecommendationVy0K0QzGGyFTW
0000000100077674 t _$s27AdaptivityWidget14Extension37LockScreenSystemImageTimelineProviderV9WidgetKit06IntenthI0AadEP15recommendationsSayAD0L14RecommendationVy0L0QzGGyFTW
U _$s9WidgetKit22IntentTimelineProviderP15recommendationsSayAA0C14RecommendationVy0C0QzGGyFTq
U _$s9WidgetKit22IntentTimelineProviderPAAE15recommendationsSayAA0C14RecommendationVy0C0QzGGyF
I have six different widgets, each of which is responsible for one of the 't' entries. This indicates those symbols are defined in my .appex. The problem is coming from the 'U' undefined symbols. These need to be resolved at dynamic link time.
According to www . swiftdemangler . com, these two undefined symbols demangle to these names:
_$s9WidgetKit22IntentTimelineProviderP15recommendationsSayAA0C14RecommendationVy0C0QzGGyFTq
method descriptor for WidgetKit.IntentTimelineProvider.recommendations() -> Swift.Array>
_$s9WidgetKit22IntentTimelineProviderPAAE15recommendationsSayAA0C14RecommendationVy0C0QzGGyF
(extension in WidgetKit):WidgetKit.IntentTimelineProvider.recommendations() -> Swift.Array>
The lowercase 't' for my own symbols means they are (according to the man page for nm) "text section symbols" that are "local (non-external)" (that's what lowercase means).
_$s27AdaptivityWidget14Extension22LayoutTimelineProviderV9WidgetKit06IntenteF0AadEP15recommendationsSayAD0I14RecommendationVy0I0QzGGyFTW
protocol witness for WidgetKit.IntentTimelineProvider.recommendations() -> Swift.Array> in conformance AdaptivityWidget14Extension.LayoutTimelineProvider : WidgetKit.IntentTimelineProvider in AdaptivityWidget14Extensio
When I do define the recommendations method in each of my intent timeline providers I get an extra 'T' entry for each of my widgets and one of the undefined symbols disappears:
/Users/geoff/Library/Developer/Xcode/DerivedData/Adaptivity-cckxaccqtttwkcadthuihwqqbxkv/Build/Products/Debug-iphoneos/AdaptivityWidget14Extension.appex
Villanelle:AdaptivityWidget14Extension.appex geoff$ nm AdaptivityWidget14Extension | grep recommendations
000000010003fed8 T _$s27AdaptivityWidget14Extension22LayoutTimelineProviderV15recommendationsSay9WidgetKit20IntentRecommendationVyAA022ADTLayoutConfigurationJ0CGGyF
000000010003ff18 t _$s27AdaptivityWidget14Extension22LayoutTimelineProviderV9WidgetKit06IntenteF0AadEP15recommendationsSayAD0I14RecommendationVy0I0QzGGyFTW
0000000100017298 T _$s27AdaptivityWidget14Extension27DynamicTypeTimelineProviderV15recommendationsSay9WidgetKit20IntentRecommendationVyAA010ADTDynamice13ConfigurationK0CGGyF
00000001000172d8 t _$s27AdaptivityWidget14Extension27DynamicTypeTimelineProviderV9WidgetKit06IntentfG0AadEP15recommendationsSayAD0J14RecommendationVy0J0QzGGyFTW
00000001000291c8 T _$s27AdaptivityWidget14Extension27SystemImageTimelineProviderV15recommendationsSay9WidgetKit20IntentRecommendationVyAA09ADTSysteme13ConfigurationK0CGGyF
0000000100029208 t _$s27AdaptivityWidget14Extension27SystemImageTimelineProviderV9WidgetKit06IntentfG0AadEP15recommendationsSayAD0J14RecommendationVy0J0QzGGyFTW
0000000100033a98 T _$s27AdaptivityWidget14Extension28SystemImagesTimelineProviderV15recommendationsSay9WidgetKit20IntentRecommendationVyAA09ADTSysteme13ConfigurationK0CGGyF
0000000100033ac4 t _$s27AdaptivityWidget14Extension28SystemImagesTimelineProviderV9WidgetKit06IntentfG0AadEP15recommendationsSayAD0J14RecommendationVy0J0QzGGyFTW
000000010002c38c T _$s27AdaptivityWidget14Extension32LockScreenLayoutTimelineProviderV15recommendationsSay9WidgetKit20IntentRecommendationVyAA07ADTLockef13ConfigurationL0CGGyF
000000010002c3cc t _$s27AdaptivityWidget14Extension32LockScreenLayoutTimelineProviderV9WidgetKit06IntentgH0AadEP15recommendationsSayAD0K14RecommendationVy0K0QzGGyFTW
00000001000775e0 T _$s27AdaptivityWidget14Extension37LockScreenSystemImageTimelineProviderV15recommendationsSay9WidgetKit20IntentRecommendationVyAA07ADTLockefg13ConfigurationM0CGGyF
0000000100077620 t _$s27AdaptivityWidget14Extension37LockScreenSystemImageTimelineProviderV9WidgetKit06IntenthI0AadEP15recommendationsSayAD0L14RecommendationVy0L0QzGGyFTW
U _$s9WidgetKit22IntentTimelineProviderP15recommendationsSayAA0C14RecommendationVy0C0QzGGyFTq
I don't know enough about linking to know why I still get this outstanding undefined symbol when Joe, presumably, does not.