<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/String/UnicodeScalarView/applying(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:SmsE8applyingyxSgs20CollectionDifferenceVy7ElementQzGF::SYNTHESIZED::s:SS17UnicodeScalarViewV"
  },
  "title" : "applying(_:)"
}
-->

# applying(_:)

Applies the given difference to this collection.

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

## Parameters

`difference`

The difference to be applied.

## 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> Complexity: O(*n* + *c*), where *n* is `self.count` and *c* is the
> number of changes contained by the parameter.

---

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)