<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSNotification/init(name:object:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSNotification(cm)notificationWithName:object:"
  },
  "title" : "init(name:object:)"
}
-->

# init(name:object:)

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

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

[`post(name:object:)`](/documentation/Foundation/NotificationCenter/post(name:object:))

Creates a notification with a given name and sender and posts it to the notification center.

  [Notification Programming Topics](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Notifications/Introduction/introNotifications.html#//apple_ref/doc/uid/10000043i)



---

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)