<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFRunLoopObserver",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@T@CFRunLoopObserverRef"
  },
  "title" : "CFRunLoopObserver"
}
-->

# CFRunLoopObserver

```
class CFRunLoopObserver
```

## Overview

A CFRunLoopObserver provides a general means to receive callbacks at different points within a running run loop. In contrast to sources, which fire when an asynchronous event occurs, and timers, which fire when a particular time passes, observers fire at special locations within the execution of the run loop, such as before sources are processed or before the run loop goes to sleep, waiting for an event to occur. Observers can be either one-time events or repeated every time through the run loop’s loop.

Each run loop observer can be registered in only one run loop at a time, although it can be added to multiple run loop modes within that run loop.

## Topics

### CFRunLoopObserver Miscellaneous Functions

[`CFRunLoopObserverCreateWithHandler(_:_:_:_:_:)`](/documentation/CoreFoundation/CFRunLoopObserverCreateWithHandler(_:_:_:_:_:))

Creates a CFRunLoopObserver object with a block-based handler.

[`CFRunLoopObserverCreate(_:_:_:_:_:_:)`](/documentation/CoreFoundation/CFRunLoopObserverCreate(_:_:_:_:_:_:))

Creates a CFRunLoopObserver object with a function callback.

[`CFRunLoopObserverDoesRepeat(_:)`](/documentation/CoreFoundation/CFRunLoopObserverDoesRepeat(_:))

Returns a Boolean value that indicates whether a CFRunLoopObserver repeats.

[`CFRunLoopObserverGetActivities(_:)`](/documentation/CoreFoundation/CFRunLoopObserverGetActivities(_:))

Returns the run loop stages during which an observer runs.

[`CFRunLoopObserverGetContext(_:_:)`](/documentation/CoreFoundation/CFRunLoopObserverGetContext(_:_:))

Returns the context information for a CFRunLoopObserver object.

[`CFRunLoopObserverGetOrder(_:)`](/documentation/CoreFoundation/CFRunLoopObserverGetOrder(_:))

Returns the ordering parameter for a CFRunLoopObserver object.

[`CFRunLoopObserverGetTypeID()`](/documentation/CoreFoundation/CFRunLoopObserverGetTypeID())

Returns the type identifier for the CFRunLoopObserver opaque type.

[`CFRunLoopObserverInvalidate(_:)`](/documentation/CoreFoundation/CFRunLoopObserverInvalidate(_:))

Invalidates a CFRunLoopObserver object, stopping it from ever firing again.

[`CFRunLoopObserverIsValid(_:)`](/documentation/CoreFoundation/CFRunLoopObserverIsValid(_:))

Returns a Boolean value that indicates whether a CFRunLoopObserver object is valid and able to fire.

### Callbacks

[`CFRunLoopObserverCallBack`](/documentation/CoreFoundation/CFRunLoopObserverCallBack)

Callback invoked when a CFRunLoopObserver object is fired.

### Data Types

[`CFRunLoopObserverContext`](/documentation/CoreFoundation/CFRunLoopObserverContext)

A structure that contains program-defined data and callbacks with which you can configure a CFRunLoopObserver object’s behavior.

### Constants

[`CFRunLoopActivity`](/documentation/CoreFoundation/CFRunLoopActivity)

Run loop activity stages in which run loop observers can be scheduled.



---

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)