Environment's foregroundColor and accentColor properties should be public

Number:rdar://FB8738204 Date Originated:Sep 24, 2020 at 7:59 PM
Status:Open Resolved:
Product:SwiftUI Product Version:
Classification: Reproducible:Yes
When implementing a View, I'd expect to have access to the specified foreground and accent colors in order to make the appearance of my view consistent with the rest of the views in the app.

This is currently not possible because `\EnvironmentValues.foregroundColor` and `\EnvironmentValues.foregroundColor` exist but are not exposed publicly through the SwiftUI API.

The expectation is this code working:

@Environment(\.foregroundColor) var foregroundColor
@Environment(\.accentColor) var accentColor

However these compilers errors arise being that they're declared as internal:

- 'foregroundColor' is inaccessible due to 'internal' protection level
- 'accentColor' is inaccessible due to 'internal' protection level

This breaks the expected mental model for what can or can't be accessed through the environment, as well as convoluting views with unneeded properties to specify these colors on a per-view basis.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!