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 }
-
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
-
Finds the first element where the
id
equals theid
of the given objectother
.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 sameid
.