<!--
{
  "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/remove(from:forMode:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSNetServiceBrowser(im)removeFromRunLoop:forMode:"
  },
  "title" : "remove(from:forMode:)"
}
-->

# remove(from:forMode:)

Removes the receiver from the specified run loop.

```
func remove(from aRunLoop: RunLoop, forMode mode: RunLoop.Mode)
```

## Parameters

`aRunLoop`

Run loop from which to remove 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 [`schedule(in:forMode:)`](/documentation/Foundation/NetServiceBrowser/schedule(in:forMode:)) to transfer the receiver to a run loop other than the default one. Although it is possible to remove an `NSNetService` object completely from any run loop and then attempt actions on it, you must not do it.

---

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)