<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSoundDelegate/sound(_:didFinishPlaying:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSSoundDelegate(im)sound:didFinishPlaying:"
  },
  "title" : "sound(_:didFinishPlaying:)"
}
-->

# sound(_:didFinishPlaying:)

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

```
@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

  [Sound Programming Topics for Cocoa](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Sound/Sound.html#//apple_ref/doc/uid/10000104i)



---

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)