ClutchEngineering / ClutchEngineering/slipstream
Add an @Entry macro for easier creation of custom Environment properties
- Dominant language
- Swift
- Stars
- 74
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Apple's documentation on the macro: https://developer.apple.com/documentation/swiftui/entry()
Rather than have to write something like this:
```swift
struct PathEnvironmentKey: EnvironmentKey {
static let defaultValue: String = "/"
}
extension EnvironmentValues {
var path: String {
get { self[PathEnvironmentKey.self] }
set { self[PathEnvironmentKey.self] = newValue }
}
}
```
We'd be able to simply do this instead:
```swift
extension EnvironmentValues {
@Entry var path: String = "/"
}
```
Will require learning [how to create a Swift macro](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/macros/).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.