enumerateEvents(in:using:)
Iterates through the music events within the track.
Declaration
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 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.