Instance Method インスタンスメソッド

contains(_:)

Returns a Boolean value that indicates whether the asynchronous sequence contains the given element. あるブール値を返します、それは非同期シーケンスがこの与えられた要素を含むかどうかを指し示します。

Declaration 宣言

func contains(_ search: Notification) async rethrows -> Bool

Parameters パラメータ

search

The element to find in the asynchronous sequence. この要素を非同期シーケンスの中で見つけ出します。

Return Value 戻り値

true if the method found the element in the asynchronous sequence; otherwise, false. true、もしメソッドがその要素をこの非同期シーケンスの中で見つけたならば;そうでなければ、false

Discussion 議論

In this example, an asynchronous sequence called Counter produces Int values from 1 to 10. The contains(_:) method checks to see whether the sequence produces the value 5: この例において、Counterと呼ばれる非同期シーケンスはInt値を1から10まで生み出します。contains(_:)メソッドは、シーケンスが値5を生み出すかどうか見るために調べます:


let containsFive = await Counter(howHigh: 10)
    .contains(5)
print(containsFive)
// Prints: true

See Also 参照

Finding Elements 要素を見つける