Open
Description
When using @Environment(\.colorScheme) var colorScheme
, Xcode prompts: Accessing Environment<ColorScheme>'s value outside of being installed on a View. This will always read the default value and will not update.
Sample code:
struct SamplePopupView: BottomPopup {
@Environment(\.colorScheme) var colorScheme
func configurePopup(popup: BottomPopupConfig) -> BottomPopupConfig {
popup.backgroundColour(colorScheme == .light ? .black : .white)
}
func createContent() -> some View {
// code
}
}
As Xcode suggests, it is not possible to change colors based on a colorScheme
.
Is there a way to fix this?
Metadata
Metadata
Assignees
Type
Projects
Status
Backlog