---
title: object
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nsnotification/object
---

# object

The object associated with the notification.

## Declaration

```swift
var object: Any? { get }
```

## Discussion

Discussion This is often the object that posted this notification. In Objective-C, it may be nil. Typically you use this method to find out what object a notification applies to when you receive a notification. For example, suppose you’ve registered an object to receive the message handlePortDeath: when the PortInvalid notification is posted to the notification center and that handlePortDeath: needs to access the object monitoring the port that is now invalid. handlePortDeath: can retrieve that object as shown here: Example of accessing notification object in Objective-C: - (void)handlePortDeath:(NSNotification *)notification {     ...     [self reclaimResourcesForPort:notification.object];     ... }

## See Also

### Getting Notification Information

- [name](foundation/nsnotification/name-swift.property.md)
- [userInfo](foundation/nsnotification/userinfo.md)
