Sequence

protocol Sequence
  • Returns an Array containing the results of mapping and filtering transform over self.

    Declaration

    Swift

    public func rsd_mapAndFilter<T>(_ transform: (Self.Iterator.Element) throws -> T?) rethrows -> [T]

    Parameters

    transform

    The method which returns either the transformed element or nil if filtered.

    Return Value

    An array of the transformed elements.

  • Returns a Dictionary containing the results of mapping and filtering transform over self where 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

    transform

    The 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 Sequence that matches the given criterion.

    Declaration

    Swift

    public func rsd_last(where evaluate: (Self.Iterator.Element) throws -> Bool) rethrows -> Self.Iterator.Element?

    Parameters

    evaluate

    The 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 Sequence after 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

    evaluate

    The 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 Sequence before 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

    evaluate

    The function to use to evaluate the search pattern.

    Return Value

    The previous element before the one that matchs the pattern.