<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVMusicTrack/enumerateEvents(in:using:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVMusicTrack(im)enumerateEventsInRange:usingBlock:"
  },
  "title" : "enumerateEvents(in:using:)"
}
-->

# enumerateEvents(in:using:)

Iterates through the music events within the track.

```
func enumerateEvents(in range: AVBeatRange, using block: (AVMusicEvent, UnsafeMutablePointer<AVMusicTimeStamp>, UnsafeMutablePointer<ObjCBool>) -> Void)
```

## Parameters

`range`

The range to iterate through.

`block`

The block to call for each event.

## Discussion

Examine each event the block returns by using <doc://com.apple.documentation/documentation/ObjectiveC/NSObjectProtocol/isKind(of:)> to determine the subclass, and then cast and access it accordingly.

The iteration may continue after removing an event.

The event object returned through the block won’t be the same instances you add to the [`AVMusicTrack`](/documentation/AVFAudio/AVMusicTrack), though the content is identical.

---

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)