---
title: "add(to:forMode:)"
framework: quartzcore
role: symbol
role_heading: Instance Method
path: "quartzcore/cadisplaylink/add(to:formode:)"
---

# add(to:forMode:)

Registers the display link with a run loop.

## Declaration

```swift
func add(to runloop: RunLoop, forMode mode: RunLoop.Mode)
```

## Parameters

- `runloop`: The run loop to associate with the display link.
- `mode`: The mode in which to add the display link to the run loop.

## Discussion

Discussion You can associate a display link with multiple input modes. While the run loop is executing in a mode you specify, the display link notifies the target when the system requires new frames. You can specify a custom mode or use one of the modes listed in RunLoop. The run loop retains the display link. To remove the display link from all run loops, call invalidate().

## See Also

### Scheduling a Display Link to Send Notifications

- [remove(from:forMode:)](quartzcore/cadisplaylink/remove(from:formode:).md)
- [invalidate()](quartzcore/cadisplaylink/invalidate().md)
