Okay. I know this shouldn't be rocket science. I can't seem to get dark mode working and I've read the documentation a few times. Hoping someone can pick out what I'm missing.
I have an named color in the asset catalog.
I set my plist mode to be in dark mode for easier testing.
My content view looks like this:
struct ContentView : View {
var body: some View {
VStack {
Text("Hello World")
Text("Yo yo yo")
.color(Color("darkModeColor"))
}
}
}
No matter what I do, the color is ALWAYS of the "Any" appearance when it should be taking on the cyan color.
I know dark mode itself works because all the system semantic colors provide by apple are working just fine as you can see the "Hello World" text changed to white.
Any ideas what I'm missing or is anyone else running into this issue with Xcode 11 Beta 1?
This is probably a bug in this beta release of Xcode 11. I tried the dark mode feature in a UIKit application and it is working perfectly using UIColor
but the same color wouldn’t work using Color
in SwiftUI. Hopefully this will be fixed in the next releases.
Update: This issue was fixed with Xcode 11 beta 3.