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

# remove(_:forMode:)

Removes a port from the specified input mode of the run loop.

## Declaration

```swift
func remove(_ aPort: Port, forMode mode: RunLoop.Mode)
```

## Parameters

- `aPort`: The port to remove from the receiver.
- `mode`: The mode from which to remove aPort. You may specify a custom mode or use one of the modes listed in Run Loop Modes.

## Discussion

Discussion If you added the port to multiple input modes, you must remove it from each mode separately.

## See Also

### Managing Ports

- [add(_:forMode:)](foundation/runloop/add(_:formode:)-6z982.md)
