Skip to content

ToggleExample produces EnvironmentValues related runtime issues #559

@Kyle-Ye

Description

@Kyle-Ye

Description

Running ToggleExample produces multiple runtime warnings about accessing Environment values outside of being installed on a View.

Runtime Warnings

Accessing Environment<Dictionary<TintPlacement, AnyShapeStyle>>'s value outside of being installed on a View. This will always read the default value and will not update.
Accessing Environment<Font>'s value outside of being installed on a View. This will always read the default value and will not update.
Accessing Environment<Dictionary<TintPlacement, AnyShapeStyle>>'s value outside of being installed on a View. This will always read the default value and will not update.
Accessing Environment<Font>'s value outside of being installed on a View. This will always read the default value and will not update.

Impact

These warnings indicate that environment values are being accessed incorrectly, which could lead to:

  • Default values being used instead of actual environment values
  • Environment changes not propagating correctly
  • Potential bugs in toggle rendering

Steps to Reproduce

  1. Run the ToggleExample app
  2. Observe the runtime warnings in the console

Investigation Needed

  • Identify where Environment<Dictionary<TintPlacement, AnyShapeStyle>> and Environment<Font> are being accessed outside the view hierarchy
  • Ensure environment values are accessed within proper view context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedPR contribution is appreciated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions