Creates a sound object that represents a custom sound file.


convenience init(named name: UNNotificationSoundName)



The name of the sound file to play. This parameter must not be nil.

Return Value

A sound object representing the custom sound.


This method searches for sound files in the following locations, in order:

  1. The <app_container>/Library/Sounds directory, where <app_container> is the app's container directory.

  2. The <group_container>/Library/Sounds directory, where <group_container> is one of the app's shared group container directories. For information about how to configure group containers for your app, see Configure app groups.

  3. The main bundle of the current executable.

The method chooses the first file it finds with the specified name.

See Also

Creating Notification Sounds

class var `default`: UNNotificationSound

Returns an object representing the default sound for notifications.