<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/DispatchSourceUserDataReplace",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "c:objc(pl)OS_dispatch_source_data_replace"
  },
  "title" : "DispatchSourceUserDataReplace"
}
-->

# DispatchSourceUserDataReplace

A dispatch source that replaces any pending data with the new value you provide.

```
protocol DispatchSourceUserDataReplace : DispatchSourceProtocol, Sendable
```

## Overview

You do not adopt this protocol in your objects. Instead, use the [`makeUserDataReplaceSource(queue:)`](/documentation/Dispatch/DispatchSource/makeUserDataReplaceSource(queue:)) method to create an object that adopts this protocol.

To replace the pending data in the dispatch source, call the [`replace(data:)`](/documentation/Dispatch/DispatchSourceUserDataReplace/replace(data:)) method.

## Topics

### Getting the Event Data

[`replace(data:)`](/documentation/Dispatch/DispatchSourceUserDataReplace/replace(data:))

Replaces the current pending data with the new value you provide.

## Relationships

### Conforming Types

[`DispatchSource`](/documentation/Dispatch/DispatchSource)

### Inherits From

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

[`DispatchSourceProtocol`](/documentation/Dispatch/DispatchSourceProtocol)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

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)