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

# schedule(in:forMode:)

Adds the service to the specified run loop.

## Declaration

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

## Parameters

- `aRunLoop`: The run loop to which to add the receiver.
- `mode`: The run loop mode to which to add 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 remove(from:forMode:) to transfer a service to a different run loop. You should not attempt to run a service on multiple run loops.

## See Also

### Managing Run Loops

- [remove(from:forMode:)](foundation/netservice/remove(from:formode:).md)
