iOS 18 seems to have broken preferredColorScheme. With the device in light mode, we first set preferredColorScheme as .dark, then we switch it to .none. The expected behaviour would be for the UI to switch from dark mode to light mode, which is what happens in previous versions. However, on iOS 18, it stays in dark mode until the app is reopened.
preferredColorScheme Broken in iOS 18
@LogicUI Can you please file a bug report at https://feedbackassistant.apple.com and add a small sample that reproduces the issue. Please paste the FB number here.
hi i facing the same issue under iOS18/.1 & iPadOS18/.1. Is there any workaround or fix coming with the final version of iOS 18 & iPadOS 18.
same issue
When you use use .preferredColorScheme or .colorScheme to modify the theme, when the tabview changes from dark to light, the tabview item color is abnormal
my code
TabView {
HomeView()
.tabItem {
Label("Home", systemImage: "chart.xyaxis.line")
}
}
.colorScheme(colorScheme) // preferredColorScheme
## or use ios18 api `Tab`
```swift
TabView {
Tab("Home", systemImage: "chart.xyaxis.line") {
SentView()
}
}
.colorScheme(colorScheme) // preferredColorScheme
steps:
- change colorScheme from .light to .dark
- then, change colorScheme from .dark to .light
Anomaly: The text "Home" in tabItem does not return to its original color, and the current background color of tabview is also abnormal. Switching to a different tabItem, the background color is restored, but the text color is still abnormal
Same issue.
Using either .preferredColorScheme or .colorScheme breaks the TabView background and foreground color, especially when changing tabs subsequently.
Also, it seems like toggling back to nil for preferredColorScheme does not have the desired result in general.