---
title: "removeObserver(_:name:object:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/distributednotificationcenter/removeobserver(_:name:object:)"
---

# removeObserver(_:name:object:)

Removes matching entries from the receiver’s dispatch table.

## Declaration

```swift
func removeObserver(_ observer: Any, name aName: NSNotification.Name?, object anObject: String?)
```

## Parameters

- `observer`: Observer to remove from the dispatch table. Specify an observer to remove only entries for this observer. When nil, the receiver does not use notification observers as criteria for removal.
- `aName`: Name of the notification to remove from dispatch table. Specify a notification name to remove only entries that specify this notification name. When nil, the receiver does not use notification names as criteria for removal.
- `anObject`: Sender to remove from the dispatch table. Specify a notification sender to remove only entries that specify this sender. When nil, the receiver does not use notification senders as criteria for removal.

## Discussion

Discussion Be sure to invoke this method with notificationName:nil notificationSender:nil (or NotificationCenter/removeObserver(_:)) before deallocating the observer object.

## See Also

### Managing Observers

- [addObserver(_:selector:name:object:)](foundation/distributednotificationcenter/addobserver(_:selector:name:object:).md)
- [addObserver(_:selector:name:object:suspensionBehavior:)](foundation/distributednotificationcenter/addobserver(_:selector:name:object:suspensionbehavior:).md)
