Swift : iTunesLibrary : how to delete item from a playlist
22:07 23 Jun 2026

I want to remove item from Songs in iTunes/Music.app programatically. I assume the correct playlist will be Music using allPlaylists.

I can get the playlist and its items with following code:

import iTunesLibrary

let itLib = try ITLibrary(apiVersion: "*")

itLib.allPlaylists.forEach { pl in
    if pl.name == "Music" {
        pl.items.forEach({ item in
            print(item.title)
        })
    }
}

However, I don't know how to remove an item from the playlist.

swift ituneslibrary