Skip to content

Sequence

kevnm67 edited this page Sep 23, 2021 · 1 revision

Extensions on Sequence

Methods

all(matching:)

Whether all elements of the collection match the given condition.

func all(matching condition: (Element) throws -> Bool) rethrows -> Bool 

Parameters

  • condition: Condition to evaluate all elements.

none(matching:)

Whether no elements match the given condition.

func none(matching condition: (Element) throws -> Bool) rethrows -> Bool 

Parameters

  • condition: Condition to evaluate each element.

any(matching:)

Whether any element matches the given condtion.

func any(matching condition: (Element) throws -> Bool) rethrows -> Bool 

Parameters

  • condition: Condition to evaluate all elements.

reject(where:)

Remove all elements matching the given condition. Returns all non-matching elements.

func reject(where condition: (Element) throws -> Bool) rethrows -> [Element] 

Parameters

  • condition: Condition to evaluate all elements.

sum()

Sum of all elements in the given sequence.

func sum() -> Element 

Clone this wiki locally