Apple's documentation on the macro: https://developer.apple.com/documentation/swiftui/entry()
Rather than have to write something like this:
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:
extension EnvironmentValues {
@Entry var path: String = "/"
}
Will require learning how to create a Swift macro.
Apple's documentation on the macro: https://developer.apple.com/documentation/swiftui/entry()
Rather than have to write something like this:
We'd be able to simply do this instead:
Will require learning how to create a Swift macro.