---
title: "enumerateEvents(in:using:)"
framework: avfaudio
role: symbol
role_heading: Instance Method
path: "avfaudio/avmusictrack/enumerateevents(in:using:)"
---

# enumerateEvents(in:using:)

Iterates through the music events within the track.

## Declaration

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

Discussion Examine each event the block returns by using 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, though the content is identical.

## See Also

### Iterating Over Events

- [AVMusicEventEnumerationBlock](avfaudio/avmusiceventenumerationblock.md)
