Open links in new tab
  1. Array | Apple Developer Documentation

    Swift makes it easy to create arrays in your code using an array literal: simply surround a comma-separated list of values with square brackets. Without any other information, Swift creates an …

  2. reduce (_:_:) | Apple Developer Documentation

    Returns an array containing the concatenated results of calling the given transformation with each element of this sequence.

  3. sort() | Apple Developer Documentation

    You can sort any mutable collection of elements that conform to the Comparable protocol by calling this method. Elements are sorted in ascending order. Here’s an example of sorting a …

  4. first | Apple Developer Documentation

    The first element of the collection.

  5. first(where:) | Apple Developer Documentation

    Discussion The following example uses the first(where:) method to find the first negative number in an array of integers:

  6. contains (where:) | Apple Developer Documentation

    Alternatively, a predicate can be satisfied by a range of Equatable elements or a general condition. This example shows how you can check an array for an expense greater than $100.

  7. joined (separator:) | Apple Developer Documentation

    Discussion This example shows how an array of [Int] instances can be joined, using another [Int] instance as the separator:

  8. ArraySlice | Apple Developer Documentation

    Sharing indices between collections and their subsequences is an important part of the design of Swift’s collection algorithms. Suppose you are tasked with finding the first two days with …

  9. sorted(by:) | Apple Developer Documentation

    In the following example, the predicate provides an ordering for an array of a custom HTTPResponse type. The predicate orders errors before successes and sorts the error …

  10. ContiguousArray | Apple Developer Documentation

    The ContiguousArray type is a specialized array that always stores its elements in a contiguous region of memory. This contrasts with Array, which can store its elements in either a …