Skip to content

Commit ad097b3

Browse files
committed
Fixes task cancellation sample code
The code calls `isCancelled` as if it were a property, but it's a Type property on `Task`. So I changed `isCancelled` to `Task.isCancelled`
1 parent 72f6eb7 commit ad097b3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

TSPL.docc/LanguageGuide/Concurrency.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ let photos = await withTaskGroup(of: Optional<Data>.self) { group in
713713
let photoNames = await listPhotos(inGallery: "Summer Vacation")
714714
for name in photoNames {
715715
group.addTaskUnlessCancelled {
716-
guard isCancelled == false else { return nil }
716+
guard Task.isCancelled == false else { return nil }
717717
return await downloadPhoto(named: name)
718718
}
719719
}

0 commit comments

Comments
 (0)