---
title: "init(name:object:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsnotification/init(name:object:)"
---

# init(name:object:)

Returns a new notification object with a specified name and object.

## Declaration

```swift
convenience init(name aName: NSNotification.Name, object anObject: Any?)
```

## Parameters

- `aName`: The name for the new notification. May not be nil.
- `anObject`: The object for the new notification.

## See Also

### Related Documentation

- [post(name:object:)](foundation/notificationcenter/post(name:object:).md)
- [Notification Programming Topics](apple-archive/documentation/Cocoa/Conceptual/Notifications/Introduction/introNotifications.html.md)

### Creating Notifications

- [init(coder:)](foundation/nsnotification/init(coder:).md)
- [init(name:object:userInfo:)](foundation/nsnotification/init(name:object:userinfo:).md)
- [NSNotification.Name](foundation/nsnotification/name-swift.struct.md)
