# ``Swift/Array``

## Topics

### Creating an Array

In addition to using an array literal, you can also create an array using these initializers.

- ``Swift/Array/init()``
- ``Swift/Array/init(_:)-1ip9h``
- ``Swift/Array/init(_:)-236cl``
- ``Swift/Array/init(repeating:count:)-5zvh4``
- ``Swift/Array/init(unsafeUninitializedCapacity:initializingWith:)``

### Inspecting an Array

- ``Swift/Array/isEmpty``
- ``Swift/Array/count-7xa9s``
- ``Swift/Array/capacity``

### Accessing Elements

- ``Swift/Array/subscript(_:)-25iat``
- ``Swift/Array/first``
- ``Swift/Array/last``
- ``Swift/Array/subscript(_:)-53fvb``
- ``Swift/Array/subscript(_:)-3kwny``
- ``Swift/Array/subscript(_:)-4h7rl``
- ``Swift/Array/subscript(_:)-3pmfg``
- ``Swift/Array/randomElement()``
- ``Swift/Array/randomElement(using:)``

### Adding Elements

- ``Swift/Array/append(_:)-1ytnt``
- ``Swift/Array/insert(_:at:)-3erb3``
- ``Swift/Array/insert(contentsOf:at:)``
- ``Swift/Array/replaceSubrange(_:with:)-6a2ai``
- ``Swift/Array/replaceSubrange(_:with:)-7293p``
- ``Swift/Array/reserveCapacity(_:)``

### Combining Arrays

- ``Swift/Array/append(contentsOf:)-21slv``
- ``Swift/Array/append(contentsOf:)-9foli``
- ``Swift/Array/+(_:_:)-6h58k``
- ``Swift/Array/+(_:_:)-n33n``
- ``Swift/Array/+(_:_:)-6t30w``
- ``Swift/Array/+(_:_:)-9fm5l``
- ``Swift/Array/+=(_:_:)-676ib``
- ``Swift/Array/+=(_:_:)-e84a``

### Removing Elements

- ``Swift/Array/remove(at:)-1p2pj``
- ``Swift/Array/removeFirst()``
- ``Swift/Array/removeFirst(_:)``
- ``Swift/Array/removeLast()``
- ``Swift/Array/removeLast(_:)``
- ``Swift/Array/removeSubrange(_:)-8may1``
- ``Swift/Array/removeSubrange(_:)-9twou``
- ``Swift/Array/removeAll(where:)-5k61r``
- ``Swift/Array/removeAll(keepingCapacity:)-1er5``
- ``Swift/Array/popLast()``

### Finding Elements

- ``Swift/Array/contains(_:)``
- ``Swift/Array/contains(where:)``
- ``Swift/Array/allSatisfy(_:)``
- ``Swift/Array/first(where:)``
- ``Swift/Array/firstIndex(of:)``
- ``Swift/Array/index(of:)``
- ``Swift/Array/firstIndex(where:)``
- ``Swift/Array/last(where:)``
- ``Swift/Array/lastIndex(of:)``
- ``Swift/Array/lastIndex(where:)``
- ``Swift/Array/min()``
- ``Swift/Array/min(by:)``
- ``Swift/Array/max()``
- ``Swift/Array/max(by:)``

### Selecting Elements

- ``Swift/Array/prefix(_:)``
- ``Swift/Array/prefix(through:)``
- ``Swift/Array/prefix(upTo:)``
- ``Swift/Array/prefix(while:)``
- ``Swift/Array/suffix(_:)``
- ``Swift/Array/suffix(from:)``

### Excluding Elements

- ``Swift/Array/dropFirst(_:)``
- ``Swift/Array/dropLast(_:)``
- ``Swift/Array/drop(while:)``

### Transforming an Array

- ``Swift/Array/flatMap(_:)-i3mr``
- ``Swift/Array/flatMap(_:)-6chu8``
- ``Swift/Array/compactMap(_:)``
- ``Swift/Array/reduce(_:_:)``
- ``Swift/Array/reduce(into:_:)``
- ``Swift/Array/lazy``

### Iterating Over an Array's Elements

- ``Swift/Array/forEach(_:)``
- ``Swift/Array/enumerated()``
- ``Swift/Array/makeIterator()``
- ``Swift/Array/underestimatedCount-4ggqp``

### Reordering an Array's Elements

- ``Swift/Array/sort()``
- ``Swift/Array/sort(by:)``
- ``Swift/Array/sorted()``
- ``Swift/Array/sorted(by:)``
- ``Swift/Array/reverse()``
- ``Swift/Array/reversed()``
- ``Swift/Array/shuffle()``
- ``Swift/Array/shuffle(using:)``
- ``Swift/Array/shuffled()``
- ``Swift/Array/shuffled(using:)``
- ``Swift/Array/partition(by:)-90po8``
- ``Swift/Array/swapAt(_:_:)``

### Splitting and Joining Elements

- ``Swift/Array/split(separator:maxSplits:omittingEmptySubsequences:)-3dgmv``
- ``Swift/Array/split(maxSplits:omittingEmptySubsequences:whereSeparator:)``
- ``Swift/Array/joined()``
- ``Swift/Array/joined(separator:)-7uber``
- ``Swift/Array/joined(separator:)-5do1g``
- ``Swift/Array/joined(separator:)-1ckod``

### Creating and Applying Differences

- ``Swift/Array/applying(_:)``
- ``Swift/Array/difference(from:)``
- ``Swift/Array/difference(from:by:)``

### Comparing Arrays

- ``Swift/Array/==(_:_:)``
- ``Swift/Array/!=(_:_:)``
- ``Swift/Array/elementsEqual(_:)``
- ``Swift/Array/elementsEqual(_:by:)``
- ``Swift/Array/starts(with:)``
- ``Swift/Array/starts(with:by:)``
- ``Swift/Array/lexicographicallyPrecedes(_:)``
- ``Swift/Array/lexicographicallyPrecedes(_:by:)``

### Manipulating Indices

- ``Swift/Array/startIndex``
- ``Swift/Array/endIndex``
- ``Swift/Array/index(after:)``
- ``Swift/Array/formIndex(after:)``
- ``Swift/Array/index(before:)``
- ``Swift/Array/formIndex(before:)``
- ``Swift/Array/index(_:offsetBy:)``
- ``Swift/Array/formIndex(_:offsetBy:)``
- ``Swift/Array/index(_:offsetBy:limitedBy:)``
- ``Swift/Array/formIndex(_:offsetBy:limitedBy:)``
- ``Swift/Array/distance(from:to:)``

### Accessing Underlying Storage

- ``Swift/Array/withUnsafeBufferPointer(_:)``
- ``Swift/Array/withUnsafeMutableBufferPointer(_:)``
- ``Swift/Array/withUnsafeBytes(_:)``
- ``Swift/Array/withUnsafeMutableBytes(_:)``
- ``Swift/Array/withContiguousStorageIfAvailable(_:)-1wj7c``
- ``Swift/Array/withContiguousMutableStorageIfAvailable(_:)-77ste``

### Encoding and Decoding

- ``Swift/Array/encode(to:)``
- ``Swift/Array/init(from:)-6rmxq``

### Describing an Array

- ``Swift/Array/description``
- ``Swift/Array/debugDescription``
- ``Swift/Array/customMirror``
- ``Swift/Array/hash(into:)``

### Related Array Types

- ``Swift/ContiguousArray``
- ``Swift/ArraySlice``

### Supporting Types

- ``Swift/Array/Index``
- ``Swift/Array/Indices``
- ``Swift/Array/Iterator``

### Working with Spans
- ``Swift/Array/span``
- ``Swift/Array/mutableSpan``

### Working with Array Differentiation
- ``Swift/Array/differentiableMap(_:)``
- ``Swift/Array/differentiableReduce(_:_:)``
- ``Swift/Array/DifferentiableView``

### Infrequently Used Functionality

- ``Swift/Array/init(arrayLiteral:)``
