---
title: "sound(_:didFinishPlaying:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nssounddelegate/sound(_:didfinishplaying:)"
---

# sound(_:didFinishPlaying:)

This delegate method is called when an NSSound instance has completed playback of its sound data.

## Declaration

```swift
@MainActor optional func sound(_ sound: NSSound, didFinishPlaying flag: Bool)
```

## Parameters

- `sound`: The NSSound that has completed playback of its sound data.
- `flag`: doc://com.apple.documentation/documentation/Swift/true when playback was successful; doc://com.apple.documentation/documentation/Swift/false otherwise.

## See Also

### Related Documentation

- [Sound Programming Topics for Cocoa](apple-archive/documentation/Cocoa/Conceptual/Sound.md)
