Why does `Color.` used as aSwiftUI ZStack background not update on TabView on a real device?
- 阅读更多 关于 Why does `Color.` used as aSwiftUI ZStack background not update on TabView on a real device?
问题 This code appears to work very well on the canvas preview, but on my real device, sometimes the background color does not update. When switching tabs, the color from the former view remains although the rest of the view is fine. What gives? Here is the main tab view: import SwiftUI struct ContentView: View { @EnvironmentObject var isModalVisible: CustomModal @ObservedObject var modal = CustomModal() var body: some View { ZStack { TabView { ZStack { Color.pink.opacity(0.2) Button(action: {