Array API Reference
Swift's Array<T> — an ordered, random-access collection of elements, backed by contiguous storage.
Array
An ordered, random-access collection. Arrays are value types in Swift.
Array.append(_ newElement: Element)Adds a new element at the end of the array.
Returns: Void
Array.count -> IntThe number of elements in the array.
Returns: Int
Array.remove(at: Int) -> ElementRemoves and returns the element at the specified position, shifting subsequent elements.
Returns: Element
Array.contains(_ element: Element) -> BoolReturns true if the array contains an element equal to the given value.
Returns: Bool
Array.map<T>(_ transform: (Element) throws -> T) rethrows -> [T]Returns an array containing the results of mapping the given closure over the sequence's elements.
Returns: [T]
Array.filter(_ isIncluded: (Element) throws -> Bool) rethrows -> [Element]Returns an array containing the elements that satisfy the given predicate.
Returns: [Element]
Array.sorted(by: (Element, Element) throws -> Bool) rethrows -> [Element]Returns the elements of the sequence, sorted using the given comparison closure.
Returns: [Element]
Array.joined(separator: String) -> StringReturns a string containing the elements of the sequence, separated by the given separator.
Returns: String