Create Widget for iOS 14 with Xcode 15.3

Hi all, I am experimenting with Widgets and I would like to add to my SwiftUI app a Widget that can be run on iOS 14.

  • My Mac has macOS Sonoma 14.4, I am using Xcode 15.3.
  • My SwiftUI app can target back to iOS 14.
  • When adding a Widget with Xcode 15.3, the Widget can only target iOS 17. If I downgrade the minimum iOS version of the Widget extension, then my project doesn't compile anymore.

I have tried multiple attempts to solve this problem. All of them have failed. If would be nice if someone could give me help on one or more of them:

  1. I have tried to install Xcode version 12.5.1, but apparently it is not possible on Sonoma. (It gets installed, but then I get an error on the first execution)
  2. I have tried to install a virtual machine in Parallels with macOS Big Sur, but I wasn't able to find the IPSW installation file from the Apple developer downloads.
  3. I have created a widget with Xcode 15.3, then replaced the files with the content of a new widget found in a YouTube video, and modified the project.pbxproj inside the xcodeproj as in the attached file (essentially I have added WidgetKit as a framework with an older version, that doesn't require iOS 17)

Now:

  • the full app compiles
  • I can test the widget in the Xcode preview
  • I can't deploy the app on both my iPhone with iOS 17.4, and on a Simulator with iOS 15.

As I am not expert, probably I miss many steps or I have done many errors. Can anyone please help me in adding an iOS 14 Widget on Xcode 15.3 on Sonoma?

Is there anyone who can please help me adding a widget to an existing app with Xcode 15.4?

Create Widget for iOS 14 with Xcode 15.3
 
 
Q