---
title: "insert(_:after:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avqueueplayer/insert(_:after:)"
---

# insert(_:after:)

Inserts a player item after another player item in the queue.

## Declaration

```swift
nonisolated func insert(_ item: AVPlayerItem, after afterItem: AVPlayerItem?)
```

## Parameters

- `item`: The item to insert into the queue.
- `afterItem`: The player item in the queue to follow. Pass nil to append the item to the queue.

## See Also

### Managing the player queue

- [items()](avfoundation/avqueueplayer/items().md)
- [advanceToNextItem()](avfoundation/avqueueplayer/advancetonextitem().md)
- [canInsert(_:after:)](avfoundation/avqueueplayer/caninsert(_:after:).md)
- [remove(_:)](avfoundation/avqueueplayer/remove(_:).md)
- [removeAllItems()](avfoundation/avqueueplayer/removeallitems().md)
