Is it possible in SwiftUI to force a View
to use light or dark mode — like overrideUserInterfaceStyle
in UIKit does?
.colorScheme()
is deprecated does not work with the background well.
.preferredColorScheme()
is the way now. Does the job with the background too.
TestView1()
.preferredColorScheme(.dark)
TestView2()
.preferredColorScheme(.light)