Instance Method

filteredIndexSet(in:includeInteger:)

Returns an IndexSet filtered according to the result of includeInteger.

Declaration

func filteredIndexSet(in range: Range<IndexSet.Element>, includeInteger: (IndexSet.Element) throws -> Bool) rethrows -> IndexSet

Parameters

range

A range of integers. For each integer in the range that intersects the integers in the IndexSet, then the includeInteger predicate will be invoked.

includeInteger

The predicate which decides if an integer will be included in the result or not.

See Also

Selecting Elements

func filter((Int) -> Bool) -> [Int]

Returns an array containing, in order, the elements of the sequence that satisfy the given predicate.

func filteredIndexSet(includeInteger: (IndexSet.Element) -> Bool) -> IndexSet

Returns an IndexSet filtered according to the result of includeInteger.

func prefix(Int) -> Slice<IndexSet>

Returns a subsequence, up to the specified maximum length, containing the initial elements of the collection.

func prefix(through: IndexSet.Index) -> Slice<IndexSet>

Returns a subsequence from the start of the collection through the specified position.

func prefix(upTo: IndexSet.Index) -> Slice<IndexSet>

Returns a subsequence from the start of the collection up to, but not including, the specified position.

func prefix(while: (Int) -> Bool) -> Slice<IndexSet>

Returns a subsequence containing the initial elements until predicate returns false and skipping the remaining elements.

func suffix(Int) -> Slice<IndexSet>

Returns a subsequence, up to the given maximum length, containing the final elements of the collection.

func suffix(from: IndexSet.Index) -> Slice<IndexSet>

Returns a subsequence from the specified position to the end of the collection.