---
title: invalidate()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/port/invalidate()
---

# invalidate()

Marks the receiver as invalid and posts an didBecomeInvalidNotification to the default notification center.

## Declaration

```swift
func invalidate()
```

## Discussion

Discussion You must call this method before releasing a port object (or removing strong references to it if your application is garbage collected).

## See Also

### Validation

- [isValid](foundation/port/isvalid.md)
