File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -26,22 +26,25 @@ public macro TaskLocal() =
26
26
27
27
#endif
28
28
29
- /// Wrapper that defines a task-local value key.
29
+ /// Wrapper type that defines a task-local value key.
30
30
///
31
31
/// A task-local value is a value that can be bound and read in the context of a
32
- /// `Task`. It is implicitly carried with the task, and is accessible by any
33
- /// child tasks the task creates (such as TaskGroup or `async let` created tasks).
32
+ /// `` Task` `. It is implicitly carried with the task, and is accessible by any
33
+ /// child tasks it creates (such as TaskGroup or `async let` created tasks).
34
34
///
35
35
/// ### Task-local declarations
36
36
///
37
- /// Task locals must be declared as static properties (or global properties,
38
- /// once property wrappers support these), like this:
37
+ /// Task locals must be declared as static properties or global properties, like this:
39
38
///
40
39
/// enum Example {
41
40
/// @TaskLocal
42
41
/// static var traceID: TraceID?
43
42
/// }
44
43
///
44
+ /// // Global task local properties are supported since Swift 6.0:
45
+ /// @TaskLocal
46
+ /// var contextualNumber: Int = 12
47
+ ///
45
48
/// ### Default values
46
49
/// Reading a task local value when no value was bound to it results in returning
47
50
/// its default value. For a task local declared as optional (such as e.g. `TraceID?`),
You can’t perform that action at this time.
0 commit comments