From 4f77bf48d4370ab77ca87e4d3e5c4781088f7e70 Mon Sep 17 00:00:00 2001 From: Emory Dunn Date: Mon, 27 Jan 2025 14:36:46 -0800 Subject: [PATCH] Update readme --- Examples/counter/Sources/counter/Settings.swift | 2 +- README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Examples/counter/Sources/counter/Settings.swift b/Examples/counter/Sources/counter/Settings.swift index d543e6a..12ae18a 100644 --- a/Examples/counter/Sources/counter/Settings.swift +++ b/Examples/counter/Sources/counter/Settings.swift @@ -10,7 +10,7 @@ import StreamDeck extension GlobalSettings { - /// A macro to define the `GlobalSettingsKey` and property used for the key path. + /// A macro to define the `GlobalSettingsKey` and property used for the key path. @Entry var count = 42 } diff --git a/README.md b/README.md index 83b93ea..5a98b1c 100644 --- a/README.md +++ b/README.md @@ -127,15 +127,15 @@ The value can be read and updated from inside an action callback. #### Macros -Starting in Swift 5.9 two new macros will be available to make declaring environmental values and global settings easier. The macro handles generating both the struct and variable for the key path. The key specified in the macro is used as the key of the setting. +Additionally, instead of manually declaring the keys, you can use the `@Entry` macro. The macro handles generating both the struct and variable for the key path. By default the name is auto-generated based on the property name, but a custom key can be provided. ```swift extension EnvironmentValues { - #environmentKey("count", defaultValue: 0, ofType: Int.self) + @Entry var count = 42 } extension GlobalSettings { - #globalSetting("count", defaultValue: 0, ofType: Int.self) + @Entry("CountDracula") var theCount = 42 } ```