---
title: "criticalSoundNamed(_:)"
framework: usernotifications
role: symbol
role_heading: Type Method
path: "usernotifications/unnotificationsound/criticalsoundnamed(_:)"
---

# criticalSoundNamed(_:)

Creates a custom sound object for critical alerts.

## Declaration

```swift
class func criticalSoundNamed(_ name: UNNotificationSoundName) -> Self
```

## Parameters

- `name`: The name of the sound file to play. This file must be located in the current executable’s main bundle or in the Library/Sounds directory of the current app container directory. If files exist at both locations, the system uses the file from the Library/Sounds directory. This parameter must not be nil.

## Return Value

Return Value A sound object representing a custom critical alert sound.

## Discussion

Discussion Critical alerts ignore the mute switch and Do Not Disturb. They require a special entitlement issued by Apple.

## See Also

### Getting Critical Sounds

- [defaultCritical](usernotifications/unnotificationsound/defaultcritical.md)
- [defaultCriticalSound(withAudioVolume:)](usernotifications/unnotificationsound/defaultcriticalsound(withaudiovolume:).md)
- [criticalSoundNamed(_:withAudioVolume:)](usernotifications/unnotificationsound/criticalsoundnamed(_:withaudiovolume:).md)
