<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/ContiguousArray",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s15ContiguousArrayV"
  },
  "title" : "ContiguousArray"
}
-->

# ContiguousArray

A contiguously stored array.

```
@frozen struct ContiguousArray<Element>
```

## Overview

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 contiguous region of memory or an
`NSArray` instance if its `Element` type is a class or `@objc` protocol.

If your array’s `Element` type is a class or `@objc` protocol and you do
not need to bridge the array to `NSArray` or pass the array to Objective-C
APIs, using `ContiguousArray` may be more efficient and have more
predictable performance than `Array`. If the array’s `Element` type is a
struct or enumeration, `Array` and `ContiguousArray` should have similar
efficiency.

For more information about using arrays, see `Array` and `ArraySlice`, with
which `ContiguousArray` shares most properties and methods.

## Relationships

### Conforms To

[`Decodable`](/documentation/Swift/Decodable)

[`Collection`](/documentation/Swift/Collection)

[`CustomReflectable`](/documentation/Swift/CustomReflectable)

[`Encodable`](/documentation/Swift/Encodable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`RandomAccessCollection`](/documentation/Swift/RandomAccessCollection)

[`OperationParameter`](/documentation/Accelerate/BNNSGraph/Builder/OperationParameter)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`ContiguousBytes`](/documentation/Foundation/ContiguousBytes)

[`AccelerateBuffer`](/documentation/Accelerate/AccelerateBuffer)

[`Copyable`](/documentation/Swift/Copyable)

[`DataProtocol`](/documentation/Foundation/DataProtocol)

[`Hashable`](/documentation/Swift/Hashable)

[`Sendable`](/documentation/Swift/Sendable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Attachable`](/documentation/Testing/Attachable)

[`Sequence`](/documentation/Swift/Sequence)

[`RangeReplaceableCollection`](/documentation/Swift/RangeReplaceableCollection)

[`ExpressibleByArrayLiteral`](/documentation/Swift/ExpressibleByArrayLiteral)

[`BidirectionalCollection`](/documentation/Swift/BidirectionalCollection)

[`AccelerateMutableBuffer`](/documentation/Accelerate/AccelerateMutableBuffer)

[`MutableDataProtocol`](/documentation/Foundation/MutableDataProtocol)

[`Escapable`](/documentation/Swift/Escapable)

[`MutableCollection`](/documentation/Swift/MutableCollection)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)