---
title: Sequence and Collection Protocols
framework: swift
role: collectionGroup
role_heading: API Collection
path: swift/sequence-and-collection-protocols
---

# Sequence and Collection Protocols

Write generic code that works with any collection, or build your own collection types.

## Topics

### First Steps

- [Sequence](swift/sequence.md)
- [Collection](swift/collection.md)

### Collection Traversal

- [BidirectionalCollection](swift/bidirectionalcollection.md)
- [RandomAccessCollection](swift/randomaccesscollection.md)

### Collection Mutability

- [MutableCollection](swift/mutablecollection.md)
- [RangeReplaceableCollection](swift/rangereplaceablecollection.md)

### Manual Iteration

- [IteratorProtocol](swift/iteratorprotocol.md)

### Algebraic Sets

- [SetAlgebra](swift/setalgebra.md)

### Lazy Collections

- [LazySequenceProtocol](swift/lazysequenceprotocol.md)
- [LazyCollectionProtocol](swift/lazycollectionprotocol.md)

## See Also

### Advanced Collection Topics

- [Supporting Types](swift/supporting-types.md)
- [Managed Buffers](swift/managed-buffers.md)
