Array

public extension Array
public extension Array where Element: Equatable
public extension Array where Element: Identifiable
  • Returns the element at the given index, or nil if the given index is out of bounds.

    Declaration

    Swift

    subscript(safe idx: Int) -> Element? { get }

Available where Element: Equatable

  • Excludes all elements in the given array

    Declaration

    Swift

    func exclude(_ other: [Element]) -> [Element]

    Parameters

    other

    Array of elements which should be excluded

    Return Value

    Reduced array without the elements in other

Available where Element: Identifiable

  • Finds the first element where the id equals the id of the given object other.

    Declaration

    Swift

    func first<T>(byId other: T) -> Element? where T : Identifiable, Element.ID == T.ID

    Parameters

    other

    Other element which conforms to Identifiable

    Return Value

    The first element of the sequence that has the same id, or nil if there is no element has the same id.