<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSound/init(named:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSound(cm)soundNamed:"
  },
  "title" : "init(named:)"
}
-->

# init(named:)

Returns the `NSSound` instance associated with a given name.

```
init?(named name: NSSound.Name)
```

## Parameters

`name`

Name that identifies sound data.

## Return Value

`NSSound` instance initialized with the sound data identified by `soundName`.

## Discussion

The returned object can be one of the following:

- One that’s been assigned a name with the [`name`](/documentation/AppKit/NSSound/name-swift.property) property
- One of the named system sounds provided by the Application Kit framework

If there’s no known `NSSound` object with `soundName`, this method tries to create one by searching for sound files in the application’s main bundle (see <doc://com.apple.documentation/documentation/Foundation/Bundle> for a description of how the bundle’s contents are searched). If no sound file can be located in the application main bundle, the following directories are searched in order:

- `~/Library/Sounds`
- `/Library/Sounds`
- `/Network/Library/Sounds`
- `/System/Library/Sounds`

If no data can be found for `soundName`, no object is created, and `nil` is returned.

The preferred way to locate a sound is to pass a name without the file extension. See the class description for a list of the supported sound file extensions.

---

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)