I looked through the completed version of this lesson, and it also does not show the background color. I’m wondering if this has to do with different versions of Swift/XCode
I looked through the completed version of this lesson, and it also does not show the background color. I’m wondering if this has to do with different versions of Swift/XCode
3
Answers
This is how Picker styled in iOS16 you can try on iOS 15 simulator and see the expected view.
In Xcode 14.1.3 beta iO16 added NavigationLinkPickerStyle which has the pre iOS 16 behavior.
You can see detailed answer from here
https://stackoverflow.com/a/73897344/1000846
I’ve been facing this issue too. It seems that the API for Picker has changed in iOS 16.
For the sake for working though the tutorial and learning Swift I got past this by installing an older version of iOS. Once I work though the tutorial I can figure out how to upgrade my code to work with iOS 16.
Go to Window -> Devices and Simulators and install iOS 15.5.
After you have installed iOS 15.5 you’ll need to change your "Minimum Deployments" to iOS 15.5 in your project file.
After setting your minimum deployment target to iOS 15.5 you can then select an iOS 15.5 device in Product -> Destination -> iPhone 13 Pro (15.5).
The tutorial should now work as expected in both the Swift UI Previews in Xcode as well as your device simulator.
If you use the latest version of iOS, in the ThemePicker file you can try to chose picker style. This is how it will looks in iOS 16.2