<!--
{
  "availability" : [
    "iOS: 2.0.0 - 27.0.0",
    "iPadOS: 2.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.2.0 - 27.0.0",
    "tvOS: 9.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NetServiceBrowser/schedule(in:forMode:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSNetServiceBrowser(im)scheduleInRunLoop:forMode:"
  },
  "title" : "schedule(in:forMode:)"
}
-->

# schedule(in:forMode:)

Adds the receiver to the specified run loop.

```
func schedule(in aRunLoop: RunLoop, forMode mode: RunLoop.Mode)
```

## Parameters

`aRunLoop`

Run loop in which to schedule the receiver.

`mode`

Run loop mode in which to perform this operation, such as [`default`](/documentation/Foundation/RunLoop/Mode/default). See the Run Loop Modes section of the [`RunLoop`](/documentation/Foundation/RunLoop) class for other run loop mode values.

## Discussion

You can use this method in conjunction with [`remove(from:forMode:)`](/documentation/Foundation/NetServiceBrowser/remove(from:forMode:)) to transfer the receiver to a run loop other than the default one. You should not attempt to run the receiver on multiple run loops.

---

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)