<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.2.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NetServiceDelegate/netServiceWillPublish(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(pl)NSNetServiceDelegate(im)netServiceWillPublish:"
  },
  "title" : "netServiceWillPublish(_:)"
}
-->

# netServiceWillPublish(_:)

Notifies the delegate that the network is ready to publish the service.

```
optional func netServiceWillPublish(_ sender: NetService)
```

## Parameters

`sender`

The service that is ready to publish.

## Discussion

Publication of the service proceeds asynchronously and may still generate a call to the delegate’s [`netService(_:didNotPublish:)`](/documentation/Foundation/NetServiceDelegate/netService(_:didNotPublish:)) method if an error occurs.

## See Also

  [Bonjour Overview](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/NetServices/Introduction.html#//apple_ref/doc/uid/10000119i)

  [NSNetServices and CFNetServices Programming Guide](https://developer.apple.com/library/archive/documentation/Networking/Conceptual/NSNetServiceProgGuide/Introduction.html#//apple_ref/doc/uid/TP40002736)



---

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)