Registers a callback function that is invoked when a specified system sound finishes playing.


func AudioServicesAddSystemSoundCompletion(_ inSystemSoundID: SystemSoundID, _ inRunLoop: CFRunLoop?, _ inRunLoopMode: CFString?, _ inCompletionRoutine: AudioServicesSystemSoundCompletionProc, _ inClientData: UnsafeMutableRawPointer?) -> OSStatus



The system sound that your callback function is to respond to.


The run loop in which the callback function should run. Pass NULL to use the main run loop.


The mode for the run loop in which the callback functions should run. Pass NULL to use the default run loop mode.


The callback function to be invoked when the specified system sound has finished playing.


Application data to be passed to your callback function when it is invoked. Can be NULL.

Return Value

A result code.


Because a system sound may play for several seconds, you might want to know when it has finished playing. For example, you may want to wait until a system sound has finished playing before you play another sound.

See Also

Adding and Removing System Sound Callbacks

func AudioServicesRemoveSystemSoundCompletion(SystemSoundID)

Unregisters any completion callback functions that were registered for a specified system sound.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software