---
title: "init(name:)"
framework: xctest
role: symbol
role_heading: Initializer
path: "xctest/xctnsnotificationexpectation/init(name:)"
---

# init(name:)

Creates an expectation that is fulfilled when an NSNotification is posted from the default notification center by any object.

## Declaration

```swift
convenience init(name notificationName: NSNotification.Name)
```

## Parameters

- `notificationName`: The notification name to watch for.

## See Also

### Creating NSNotification Expectations

- [init(name:object:)](xctest/xctnsnotificationexpectation/init(name:object:).md)
- [init(name:object:notificationCenter:)](xctest/xctnsnotificationexpectation/init(name:object:notificationcenter:).md)
