---
title: ContiguousArray
framework: swift
role: symbol
role_heading: Structure
path: swift/contiguousarray
---

# ContiguousArray

A contiguously stored array.

## Declaration

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

## Overview

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.

## Topics

### Initializers

- [init(_:)](swift/contiguousarray/init(_:).md)
- [init(capacity:initializingWith:)](swift/contiguousarray/init(capacity:initializingwith:).md)
- [init(unsafeUninitializedCapacity:initializingWith:)](swift/contiguousarray/init(unsafeuninitializedcapacity:initializingwith:).md)

### Instance Properties

- [capacity](swift/contiguousarray/capacity.md)
- [mutableSpan](swift/contiguousarray/mutablespan.md)
- [span](swift/contiguousarray/span.md)

### Instance Methods

- [append(addingCapacity:initializingWith:)](swift/contiguousarray/append(addingcapacity:initializingwith:).md)
- [insert(_:at:)](swift/contiguousarray/insert(_:at:).md)
- [isTriviallyIdentical(to:)](swift/contiguousarray/istriviallyidentical(to:).md)
- [remove(at:)](swift/contiguousarray/remove(at:).md)
- [reserveCapacity(_:)](swift/contiguousarray/reservecapacity(_:).md)
- [withBytes(_:)](swift/contiguousarray/withbytes(_:).md)
- [withUnsafeBufferPointer(_:)](swift/contiguousarray/withunsafebufferpointer(_:).md)
- [withUnsafeBytes(_:)](swift/contiguousarray/withunsafebytes(_:).md)
- [withUnsafeMutableBufferPointer(_:)](swift/contiguousarray/withunsafemutablebufferpointer(_:).md)
- [withUnsafeMutableBytes(_:)](swift/contiguousarray/withunsafemutablebytes(_:).md)

### Default Implementations

- [Attachable Implementations](swift/contiguousarray/attachable-implementations.md)
- [BidirectionalCollection Implementations](swift/contiguousarray/bidirectionalcollection-implementations.md)
- [Collection Implementations](swift/contiguousarray/collection-implementations.md)
- [CustomDebugStringConvertible Implementations](swift/contiguousarray/customdebugstringconvertible-implementations.md)
- [CustomReflectable Implementations](swift/contiguousarray/customreflectable-implementations.md)
- [CustomStringConvertible Implementations](swift/contiguousarray/customstringconvertible-implementations.md)
- [Decodable Implementations](swift/contiguousarray/decodable-implementations.md)
- [Encodable Implementations](swift/contiguousarray/encodable-implementations.md)
- [Equatable Implementations](swift/contiguousarray/equatable-implementations.md)
- [ExpressibleByArrayLiteral Implementations](swift/contiguousarray/expressiblebyarrayliteral-implementations.md)
- [Hashable Implementations](swift/contiguousarray/hashable-implementations.md)
- [MutableCollection Implementations](swift/contiguousarray/mutablecollection-implementations.md)
- [OperationParameter Implementations](swift/contiguousarray/operationparameter-implementations.md)
- [RandomAccessCollection Implementations](swift/contiguousarray/randomaccesscollection-implementations.md)
- [RangeReplaceableCollection Implementations](swift/contiguousarray/rangereplaceablecollection-implementations.md)
- [Sequence Implementations](swift/contiguousarray/sequence-implementations.md)

## Relationships

### Conforms To

- [AccelerateBuffer](accelerate/acceleratebuffer.md)
- [AccelerateMutableBuffer](accelerate/acceleratemutablebuffer.md)
- [Attachable](testing/attachable.md)
- [BNNSGraph.Builder.OperationParameter](accelerate/bnnsgraph/builder/operationparameter.md)
- [BidirectionalCollection](swift/bidirectionalcollection.md)
- [Collection](swift/collection.md)
- [ContiguousBytes](foundation/contiguousbytes.md)
- [Copyable](swift/copyable.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomReflectable](swift/customreflectable.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [DataProtocol](foundation/dataprotocol.md)
- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [ExpressibleByArrayLiteral](swift/expressiblebyarrayliteral.md)
- [Hashable](swift/hashable.md)
- [MutableCollection](swift/mutablecollection.md)
- [MutableDataProtocol](foundation/mutabledataprotocol.md)
- [RandomAccessCollection](swift/randomaccesscollection.md)
- [RangeReplaceableCollection](swift/rangereplaceablecollection.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [Sequence](swift/sequence.md)

## See Also

### Related Array Types

- [ArraySlice](swift/arrayslice.md)
