<!--
{
  "availability" : [
    "iOS: 9.3.0 -",
    "iPadOS: 9.3.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MediaPlayer",
  "identifier" : "/documentation/MediaPlayer/MPMediaPlaylist/add(_:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Media Player"
    ],
    "preciseIdentifier" : "c:objc(cs)MPMediaPlaylist(im)addMediaItems:completionHandler:"
  },
  "title" : "add(_:completionHandler:)"
}
-->

# add(_:completionHandler:)

Adds an array of media items to the end of the playlist.

```
func add(_ mediaItems: [MPMediaItem], completionHandler: (@Sendable ((any Error)?) -> Void)? = nil)
```

## Parameters

`mediaItems`

The array of media items to add to the end of the playlist.

`completionHandler`

A block that the system calls after it adds the media items to the playlist.

- error: If an error occurred, this parameter holds the error object that explains the error. Otherwise, the value of this parameter is <doc://com.apple.documentation/documentation/ObjectiveC/nil-227m0>.

## Discussion

---

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)