---
title: "replaceSubrange(_:with:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/slice/replacesubrange(_:with:)-904p8"
---

# replaceSubrange(_:with:)

## Declaration

```swift
mutating func replaceSubrange<C>(_ subRange: Range<Slice<Base>.Index>, with newElements: C) where C : Collection, Base.Element == C.Element
```
