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

# schedule(in:forMode:)

This method should be implemented by a subclass to set up monitoring of a port when added to a given run loop in a given input mode.

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

## Parameters

`runLoop`

The run loop to which to add the receiver.

`mode`

The run loop mode to which to add the receiver

## Discussion

This method should not be called directly.

---

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)