<!--
{
  "availability" : [
    "iOS: 3.1.0 -",
    "iPadOS: 3.1.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "QuartzCore",
  "identifier" : "/documentation/QuartzCore/CADisplayLink/add(to:forMode:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Animation"
    ],
    "preciseIdentifier" : "c:objc(cs)CADisplayLink(im)addToRunLoop:forMode:"
  },
  "title" : "add(to:forMode:)"
}
-->

# add(to:forMode:)

Registers the display link with a run loop.

```
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

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 <doc://com.apple.documentation/documentation/Foundation/RunLoop>.

The run loop retains the display link. To remove the display link from all run loops, call [`invalidate()`](/documentation/QuartzCore/CADisplayLink/invalidate()).

---

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)