PhotosUI does not build with UIKit and WidgetKit in XCode26

To reproduce this bug create a new Xcode Project for IOS choose UIKit. In the app delegate add the following lines.

As you can see in the above image . Line 19 with the initialization of PHPickerViewController has no compilation failure.

Now lets add import WidgetKit

As soon as widgetKit is imported a compiler error is thrown which is PHPickerViewController is not in scope.

This worked with Xcode 16.4

It was possible to have a swift file with both WidgetKit implementations and PhotosUI implementations. This behavior has changed in Xcode 26/26.0.1 .

Does anybody know why this happens , could not find any clues within the different versions of documentations. P.S

Found a work around which raises further questions

Adding import SwiftUI fixes this problem , I am genuinely curious on how this is happening on a compiler level.

LINKS To my previously published post :https://developer.apple.com/forums/thread/804059

PhotosUI does not build with UIKit and WidgetKit in XCode26
 
 
Q