Pick the fix
You need a custom accent environment value with a default of .blue. Which is the shortest correct code?
Hint 1 of 1
Which macro arrived with Xcode 16?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A extension EnvironmentValues { @Entry var accent: Color = .blue }
Correct. @Entry generates the key and accessors.
Why not the others?
- B A
struct AccentKey: EnvironmentKeyplus a computed property. Still valid, but it is the old, longer way that @Entry replaces. - C
@Environment var accent: Color = .bluein each view. @Environment needs a key path or type to read from. - D
static var accent = Color.blueon a global type. A global isn't scoped to a subtree and can't be overridden per view.