<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/DispatchSource/makeWriteSource(fileDescriptor:queue:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "s:So18OS_dispatch_sourceC8DispatchE15makeWriteSource14fileDescriptor5queueSo0a1_b1_C6_write_ps5Int32V_So0a1_b1_J0CSgtFZ"
  },
  "title" : "makeWriteSource(fileDescriptor:queue:)"
}
-->

# makeWriteSource(fileDescriptor:queue:)

Creates a new dispatch source object for writing data to the specified file.

```
class func makeWriteSource(fileDescriptor: Int32, queue: DispatchQueue? = nil) -> any DispatchSourceWrite
```

## Parameters

`fileDescriptor`

A file descriptor pointing to an open file or socket. The dispatch source begins writing at the file descriptor’s current location.

`queue`

The dispatch queue to use when executing the installed handlers.

## Return Value

A dispatch source object that conforms to the [`DispatchSourceWrite`](/documentation/Dispatch/DispatchSourceWrite) protocol.

## Discussion

After creating the dispatch source, use the methods of the [`DispatchSourceProtocol`](/documentation/Dispatch/DispatchSourceProtocol) protocol to install the event handlers you need. The returned dispatch source is in the inactive state initially. When you are ready to begin processing events, call its [`activate()`](/documentation/Dispatch/DispatchObject/activate()) method.

---

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)