Apple framework for Spotify Authentication & Interacting with Services
SpotifyKit
iOS Library to authenticate and interact with Spotify services.
Install
You can integrate this framework via Cocoapods.
pod 'Spotify-Kit'
Features
- Spotify OAuth Support: Log In, Refresh Token, Persist Credentials Securely
- Fetch Albums
- Fetch Artists
- Fetch Playlists
- Search Content
- Get User Specific Top Content (artists, tracks, playlists)
- Get New Releases
- Update/Create/Delete content in user library (auth required)
- Get Top Charts & Trending Content
- More ?
Usage
- Configure the SDK via the singleton’s configure method.
let config = SpotifyKitConfiguration(...)
SpotifyAuthManager.shared.configure(config)
-
Leverage auth APIs to authenticate a user and obtain OAuth credentials.
-
Make calls against SpotifyAPIManager. The library handles creation of signed/authenticated requests for you.
// Fetch a users top streamed tracks of all time
SpotifyAPIManager.shared.getTopContent(
.tracks,
for: .lifetime
) { result in
switch result {
case .success(let tracks):
for track in tracks {
print(track.name)
print(track.artist)
print(track.preview_url)
// ...
}
csae .failure(let error):
print(error.localizedDescription)
break
}
}