Sequence
protocol Sequence
-
Returns an
Arraycontaining the results of mapping and filteringtransformoverself.Declaration
Swift
public func rsd_mapAndFilter<T>(_ transform: (Self.Iterator.Element) throws -> T?) rethrows -> [T]Parameters
transformThe method which returns either the transformed element or
nilif filtered.Return Value
An array of the transformed elements.
-
Returns a
Dictionarycontaining the results of mapping and filteringtransformoverselfwhere the returned values are a key/value pair.Declaration
Swift
public func rsd_filteredDictionary<Hashable, T>(_ transform: (Self.Iterator.Element) throws -> (Hashable, T)?) rethrows -> [Hashable: T]Parameters
transformThe function used to transform the input sequence into a key/value pair
Return Value
A dictionary of key/value pairs.
-
Find the last element in the
Sequencethat matches the given criterion.Declaration
Swift
public func rsd_last(where evaluate: (Self.Iterator.Element) throws -> Bool) rethrows -> Self.Iterator.Element?Parameters
evaluateThe function to use to evaluate the search pattern.
Return Value
The element that matches the pattern, searching in reverse.
-
Find the next element in the
Sequenceafter the element that matches the given criterion.Declaration
Swift
public func rsd_next(after evaluate: (Self.Iterator.Element) throws -> Bool) rethrows -> Self.Iterator.Element?Parameters
evaluateThe function to use to evaluate the search pattern.
Return Value
The next element after the one that matchs the pattern.
-
Find the previous element in the
Sequencebefore the element that matches the given criterion. Evaluation is performed on the reversed enumeration.Declaration
Swift
public func rsd_previous(before evaluate: (Self.Iterator.Element) throws -> Bool) rethrows -> Self.Iterator.Element?Parameters
evaluateThe function to use to evaluate the search pattern.
Return Value
The previous element before the one that matchs the pattern.
View on GitHub
Sequence Extension Reference