---
title: "remove(from:forMode:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/netservice/remove(from:formode:)"
---

# remove(from:forMode:)

Removes the service from the given run loop for a given mode.

## Declaration

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

## Parameters

- `aRunLoop`: The run loop from which to remove the receiver.
- `mode`: The run loop mode from which to remove the receiver. Possible values for mode are discussed in the “Constants” section of doc://com.apple.foundation/documentation/Foundation/RunLoop.

## Discussion

Discussion You can use this method in conjunction with schedule(in:forMode:) to transfer the service to a different run loop. Although it is possible to remove an NSNetService object completely from any run loop and then attempt actions on it, it is an error to do so.

## See Also

### Managing Run Loops

- [schedule(in:forMode:)](foundation/netservice/schedule(in:formode:).md)
