Skip to content

Instantly share code, notes, and snippets.

@jacobsapps
Created October 22, 2025 12:28
Show Gist options
  • Select an option

  • Save jacobsapps/9445d9779c2136308602d4ca6be20a7f to your computer and use it in GitHub Desktop.

Select an option

Save jacobsapps/9445d9779c2136308602d4ca6be20a7f to your computer and use it in GitHub Desktop.
enum User {
@TaskLocal static var name = "n/a"
}
Task {
print(User.name) // n/a
User.$name.withValue("Alice") {
print(User.name) // Alice
Task {
print(User.name) // Alice
User.$name.withValue("Bob") {
print(User.name) // Bob
}
print(User.name) // Alice
}
print(User.name) // Alice
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment