Skip to content

Commit e6a2e17

Browse files
author
Chris Adamson
committed
Use multiple trailing closures in doc snippet.
1 parent 8201bda commit e6a2e17

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

stdlib/public/Concurrency/AsyncStream.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,14 @@ public struct AsyncStream<Element> {
286286
/// iteration).
287287
///
288288
/// The following example shows an `AsyncStream` created with this
289-
/// initializer that produces random numbers on a one-second interval.
289+
/// initializer that produces random numbers on a one-second interval. This
290+
/// example uses Swift's multiple trailing closure syntax, which omits
291+
/// the `unfolding` parameter label.
290292
///
291-
/// let stream = AsyncStream<Int>(
292-
/// unfolding: {
293+
/// let stream = AsyncStream<Int> {
293294
/// await Task.sleep(1 * 1_000_000_000)
294295
/// return Int.random(in: 1...10)
295-
/// },
296+
/// }
296297
/// onCancel: { @Sendable () in print ("Canceled.") }
297298
/// )
298299
///

stdlib/public/Concurrency/AsyncThrowingStream.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public struct AsyncThrowingStream<Element, Failure: Error> {
327327
/// The following example shows an `AsyncThrowingStream` created with this
328328
/// initializer that produces random numbers on a one-second interval. If the
329329
/// random number is divisble by 5 with no remainder, the stream throws a
330-
/// `MyRandomNumberError`.
330+
/// `MyRandomNumberError`.
331331
///
332332
/// let stream = AsyncThrowingStream<Int, Error> {
333333
/// await Task.sleep(1 * 1_000_000_000)

0 commit comments

Comments
 (0)