how to check if there is dark mode code wise swiftui
//You can use the colorScheme Environment Key
struct ContentView: View {
@Environemnt(\.colorScheme) var colorScheme
var body: some View {
Text("Hello")
.foregroundColor(colorScheme == .light ? .black : .white)
//The tenary operator checks if the view is either in light mode or in dark mode
//If it is in light mode, the font colour of the text would be black, otherwise it is white
}
}