Last active
February 4, 2022 11:17
-
-
Save SebastianBoldt/eaf089804efec8da852779b4f882a954 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum TaskData { | |
@TaskLocal static var userId: Int? | |
} | |
Task { | |
await TaskData.$userId.withValue(786) { | |
let task = Task { | |
print(TaskData.userId ?? "No User Id") | |
} | |
print(TaskData.userId ?? "No User Id") | |
} | |
await TaskData.$userId.withValue(234) { | |
let task = Task { | |
print(TaskData.userId ?? "No User Id") | |
} | |
print(TaskData.userId ?? "No User Id") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment