---
title: "AXObserverAddNotification(_:_:_:_:)"
framework: Application Services
role: symbol
role_heading: Function
platforms: [macOS 10.2+]
path: applicationservices/1462089-axobserveraddnotification
---

# AXObserverAddNotification(_:_:_:_:)

Registers the specified observer to receive notifications from the specified accessibility object.

## Declaration

```swift
func AXObserverAddNotification(_ observer: AXObserver, _ element: AXUIElement, _ notification: CFString, _ refcon: UnsafeMutableRawPointer?) -> AXError
```

## Parameters

- `observer`: The observer object created from a call to doc://com.apple.documentation/documentation/applicationservices/1460133-axobservercreate.
- `element`: The accessibility object for which to observe notifications.
- `notification`: The name of the notification to observe.
- `refcon`: Application-defined data passed to the callback when it is called.

## Return Value

Return Value If unsuccessful, AXObserverAddNotification may return one of the following error codes, among others:

## See Also

### Notification API

- [AXObserverCreate(_:_:_:)](applicationservices/1460133-axobservercreate.md)
- [AXObserverCreateWithInfoCallback(_:_:_:)](applicationservices/1460610-axobservercreatewithinfocallback.md)
- [AXObserverGetRunLoopSource(_:)](applicationservices/1459139-axobservergetrunloopsource.md)
- [AXObserverGetTypeID()](applicationservices/1461244-axobservergettypeid.md)
- [AXObserverRemoveNotification(_:_:_:)](applicationservices/1462066-axobserverremovenotification.md)
