Instance Methodsliemeobn.elementary 0.5.0Elementary
environment(_:_:)
Sets the value of a TaskLocal
for the duration of rendering the content.
func environment<T>(_ taskLocal: TaskLocal<T>, _ value: T) -> _ModifiedTaskLocal<T, Self> where T : Sendable
The value can be accessed using the Environment
property wrapper. Elementary uses task-locals as the underlying storage system for environment variables.
enum Values {
@TaskLocal static var myNumber = 0
}
div {
MyNumber()
.environment(Values.$myNumber, 15)
}