---
title: "applying(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/arrayslice/applying(_:)"
---

# applying(_:)

Applies the given difference to this collection.

## Declaration

```swift
func applying(_ difference: CollectionDifference<Self.Element>) -> Self?
```

## Parameters

- `difference`: The difference to be applied.

## Return Value

Return Value An instance representing the state of the receiver with the difference applied, or nil if the difference is incompatible with the receiver’s state.

## Discussion

Discussion note: O(n + c), where n is self.count and c is the number of changes contained by the parameter.
