---
title: "publisher(for:object:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/notificationcenter/publisher(for:object:)"
---

# publisher(for:object:)

Returns a publisher that emits events when broadcasting notifications.

## Declaration

```swift
func publisher(for name: Notification.Name, object: AnyObject? = nil) -> NotificationCenter.Publisher
```

## Parameters

- `name`: The name of the notification to publish.
- `object`: The object posting the named notification. If nil, the publisher emits elements for any object producing a notification with the given name.

## Return Value

Return Value A Publisher that emits events when broadcasting notifications.

## See Also

### Receiving notifications as a Combine publisher

- [NotificationCenter.Publisher](foundation/notificationcenter/publisher.md)
