mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
9ead8781d4
Co-authored-by: Alex Martini <amartini@apple.com> Co-authored-by: Graham Lee <glee23@apple.com> Co-authored-by: Chris Adamson <cadamson@apple.com> Co-authored-by: Kirby Turner <kirby_turner@apple.com> Co-authored-by: Paris Pinkney <ppinkney@apple.com> Co-authored-by: Dave Spector <dspector@apple.com> Co-authored-by: Sofia Rodriguez Morales <sofia_rodriguez@apple.com> Co-authored-by: Ethan Kusters <ekusters@apple.com> Co-authored-by: Goli Mohammadi <g_mohammadi@apple.com> Co-authored-by: Adora Vaz <a_vaz@apple.com> Co-authored-by: David Rönnqvist <ronnqvist@apple.com> Co-authored-by: Nate Merseth Cook <natecook@apple.com> Co-authored-by: Susan Conant <susan_c@apple.com>
5.6 KiB
5.6 KiB
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(_:)-1ip9hSwift/Array/init(_:)-236clSwift/Array/init(repeating:count:)-5zvh4Swift/Array/init(unsafeUninitializedCapacity:initializingWith:)
Inspecting an Array
Swift/Array/isEmptySwift/Array/count-7xa9sSwift/Array/capacity
Accessing Elements
Swift/Array/subscript(_:)-25iatSwift/Array/firstSwift/Array/lastSwift/Array/subscript(_:)-53fvbSwift/Array/subscript(_:)-3kwnySwift/Array/subscript(_:)-4h7rlSwift/Array/subscript(_:)-3pmfgSwift/Array/randomElement()Swift/Array/randomElement(using:)
Adding Elements
Swift/Array/append(_:)-1ytntSwift/Array/insert(_:at:)-3erb3Swift/Array/insert(contentsOf:at:)Swift/Array/replaceSubrange(_:with:)-6a2aiSwift/Array/replaceSubrange(_:with:)-7293pSwift/Array/reserveCapacity(_:)
Combining Arrays
Swift/Array/append(contentsOf:)-21slvSwift/Array/append(contentsOf:)-9foliSwift/Array/+(_:_:)-6h58kSwift/Array/+(_:_:)-n33nSwift/Array/+(_:_:)-6t30wSwift/Array/+(_:_:)-9fm5lSwift/Array/+=(_:_:)-676ibSwift/Array/+=(_:_:)-e84a
Removing Elements
Swift/Array/remove(at:)-1p2pjSwift/Array/removeFirst()Swift/Array/removeFirst(_:)Swift/Array/removeLast()Swift/Array/removeLast(_:)Swift/Array/removeSubrange(_:)-8may1Swift/Array/removeSubrange(_:)-9twouSwift/Array/removeAll(where:)-5k61rSwift/Array/removeAll(keepingCapacity:)-1er5Swift/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(_:)-i3mrSwift/Array/flatMap(_:)-6chu8Swift/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:)-90po8Swift/Array/swapAt(_:_:)
Splitting and Joining Elements
Swift/Array/split(separator:maxSplits:omittingEmptySubsequences:)-3dgmvSwift/Array/split(maxSplits:omittingEmptySubsequences:whereSeparator:)Swift/Array/joined()Swift/Array/joined(separator:)-7uberSwift/Array/joined(separator:)-5do1gSwift/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/startIndexSwift/Array/endIndexSwift/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(_:)-1wj7cSwift/Array/withContiguousMutableStorageIfAvailable(_:)-77ste
Encoding and Decoding
Swift/Array/encode(to:)Swift/Array/init(from:)-6rmxq
Describing an Array
Swift/Array/descriptionSwift/Array/debugDescriptionSwift/Array/customMirrorSwift/Array/hash(into:)
Related Array Types
Swift/ContiguousArraySwift/ArraySlice
Supporting Types
Swift/Array/IndexSwift/Array/IndicesSwift/Array/Iterator
Working with Spans
Swift/Array/spanSwift/Array/mutableSpan
Working with Array Differentiation
Swift/Array/differentiableMap(_:)Swift/Array/differentiableReduce(_:_:)Swift/Array/DifferentiableView
Infrequently Used Functionality
Swift/Array/init(arrayLiteral:)