---
title: "add(to:forMode:)"
framework: quartzcore
role: symbol
role_heading: Instance Method
path: "quartzcore/cametaldisplaylink/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`: A run loop instance the method associates with the display link.
- `mode`: A run loop mode for the display link.

## Discussion

Discussion You can associate the display link with any of the RunLoop modes, multiple input modes, or a custom mode. When the run loop is in mode, the display link notifies its delegate when the system prepares the next frame. You can remove the display link from a run loop by calling remove(from:forMode:), or from all run loops with invalidate().
