Swiftpack.co -  tedbennett/SpotifyForSwift as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Swift wrapper for the Spotify API
.package(url: "https://github.com/tedbennett/SpotifyForSwift.git", from: "v0.1.4")

Spotify For Swift 🎢

Wrapper for the Spotify Music API written in Swift


This is a package to make interacting with the Spotify API a lot easier. It's a pretty nice API to deal with, but this package will automatically handle things like paginated responses, too many requests, and a few of the API's oddities (like externally hosted music...)

I decided to create this after trying to build an app for sharing playlists between Apple Music and Spotify, and getting pretty frustrated working with the API.

So far, this package can perform only the most basic interactions with the API, but it can handle paginated responses and the Too Many Requests error. See below for the full list of implemented capabilities

This package depends on the OAuth2 package to handle authentication


  • Obviously, implement all endpoints!
  • Improve error handling, give more verbose response, including:
    • Insufficient client scope
    • Auth errors
  • Work on extra auth flows
  • Work on better handling incomplete data, such as that returned from local files in playlists
  • Work on cases with uncommon response formats, e.g playlists containing tracks or episodes

Full table of implemented endpoints

API Endpoint Implemented? Notes
GET https://api.spotify.com/v1/albums βœ…
GET https://api.spotify.com/v1/albums/{id} βœ…
GET https://api.spotify.com/v1/artists βœ…
GET https://api.spotify.com/v1/artists/{id} βœ…
GET https://api.spotify.com/v1/artists/{id}/top-tracks βœ…
GET https://api.spotify.com/v1/artists/{id}/related-artists βœ…
GET https://api.spotify.com/v1/artists/{id}/albums βœ…
GET https://api.spotify.com/v1/browse/new-releases ❌
GET https://api.spotify.com/v1/browse/featured-playlists ❌
GET https://api.spotify.com/v1/browse/categories ❌
GET https://api.spotify.com/v1/browse/categories/{category_id} ❌
GET https://api.spotify.com/v1/browse/categories/{category_id}/playlists ❌
GET https://api.spotify.com/v1/recommendations ❌
GET https://api.spotify.com/v1/episodes ❌
GET https://api.spotify.com/v1/episodes/{id} ❌
PUT https://api.spotify.com/v1/playlists/{playlist_id}/followers ❌
DELETE https://api.spotify.com/v1/playlists/{playlist_id}/followers ❌
GET https://api.spotify.com/v1/playlists/{playlist_id}/followers/contains ❌
GET https://api.spotify.com/v1/me/following ❌
PUT https://api.spotify.com/v1/me/following ❌
DELETE https://api.spotify.com/v1/me/following ❌
GET https://api.spotify.com/v1/me/following/contains ❌
GET https://api.spotify.com/v1/me/albums βœ…
PUT https://api.spotify.com/v1/me/albums βœ…
DELETE https://api.spotify.com/v1/me/albums ❌
GET https://api.spotify.com/v1/me/albums/contains ❌
GET https://api.spotify.com/v1/me/tracks βœ…
PUT https://api.spotify.com/v1/me/tracks βœ…
DELETE https://api.spotify.com/v1/me/tracks ❌
GET https://api.spotify.com/v1/me/tracks/contains ❌
GET https://api.spotify.com/v1/me/shows ❌
PUT https://api.spotify.com/v1/me/shows ❌
DELETE https://api.spotify.com/v1/me/shows ❌
GET https://api.spotify.com/v1/me/shows/contains ❌
GET https://api.spotify.com/v1/me/top/{type} ❌
GET https://api.spotify.com/v1/me/player ❌
PUT https://api.spotify.com/v1/me/player ❌
GET https://api.spotify.com/v1/me/player/devices ❌
GET https://api.spotify.com/v1/me/player/currently-playing ❌
PUT https://api.spotify.com/v1/me/player/play ❌
PUT https://api.spotify.com/v1/me/player/pause ❌
POST https://api.spotify.com/v1/me/player/next ❌
POST https://api.spotify.com/v1/me/player/previous ❌
PUT https://api.spotify.com/v1/me/player/seek ❌
PUT https://api.spotify.com/v1/me/player/repeat ❌
PUT https://api.spotify.com/v1/me/player/volume ❌
PUT https://api.spotify.com/v1/me/player/shuffle ❌
GET https://api.spotify.com/v1/me/player/recently-played ❌
POST https://api.spotify.com/v1/me/player/queue βœ…
GET https://api.spotify.com/v1/me/playlists βœ…
GET https://api.spotify.com/v1/users/{user_id}/playlists βœ…
POST https://api.spotify.com/v1/users/{user_id}/playlists ❌
GET https://api.spotify.com/v1/playlists/{playlist_id} βœ…
PUT https://api.spotify.com/v1/playlists/{playlist_id} ❌
GET https://api.spotify.com/v1/playlists/{playlist_id}/tracks βœ…
POST https://api.spotify.com/v1/playlists/{playlist_id}/tracks ❌
PUT https://api.spotify.com/v1/playlists/{playlist_id}/tracks ❌
DELETE https://api.spotify.com/v1/playlists/{playlist_id}/tracks ❌
GET https://api.spotify.com/v1/playlists/{playlist_id}/images βœ…
PUT https://api.spotify.com/v1/playlists/{playlist_id}/images ❌
GET https://api.spotify.com/v1/search βœ…
GET https://api.spotify.com/v1/shows ❌
GET https://api.spotify.com/v1/shows/{id} ❌
GET https://api.spotify.com/v1/shows/{id}/episodes ❌
GET https://api.spotify.com/v1/tracks βœ…
GET https://api.spotify.com/v1/tracks/{id} βœ…
GET https://api.spotify.com/v1/audio-features ❌
GET https://api.spotify.com/v1/audio-features/{id} ❌
GET https://api.spotify.com/v1/audio-analysis/{id} ❌
GET https://api.spotify.com/v1/me βœ…
GET https://api.spotify.com/v1/users/{user_id} ❌


Stars: 0
Last commit: 3 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

29 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API