On this page
ControlNotificationStream.contains(where:)
- Declared in
- ControlNotificationStream
- Package
- libtmux-swift
-
Returns a Boolean value that indicates whether the asynchronous sequence contains an element that satisfies the given predicate.
You can use the predicate to check for an element of a type that doesn’t conform to the
Equatableprotocol, or to find an element that satisfies a general condition.In this example, an asynchronous sequence called
CounterproducesIntvalues from1to10. Thecontains(where:)method checks to see whether the sequence produces a value divisible by3:let containsDivisibleByThree = await Counter(howHigh: 10) .contains { $0 % 3 == 0 } print(containsDivisibleByThree) // Prints "true"
The predicate executes each time the asynchronous sequence produces an element, until either the predicate finds a match or the sequence ends.
- Parameter predicate: A closure that takes an element of the asynchronous sequence as its argument and returns a Boolean value that indicates whether the passed element represents a match.
- Returns:
trueif the sequence contains an element that satisfies predicate; otherwise,false.
- Raises
0 declared, 0 inherited