Required Instance Methodswift 6.0.1Swift

    reserveCapacity(_:)

    Prepares the collection to store the specified number of elements, when doing so is appropriate for the underlying type.

    mutating func reserveCapacity(_ n: Int)

    Parameters

    n

    The requested number of elements to store.

    If you are adding a known number of elements to a collection, use this method to avoid multiple reallocations. A type that conforms to RangeReplaceableCollection can choose how to respond when this method is called. Depending on the type, it may make sense to allocate more or less storage than requested, or to take no action at all.

    Other requirements

    View members

    Hide members

    This section is hidden by default because it contains too many (17) members.

    Type members

    Instance members

    Citizens in Swift

    Default implementations

    • func reserveCapacity(Int)

      Prepares the collection to store the specified number of elements, when doing so is appropriate for the underlying type.