Interact with the Spotify Web API in Swift
This app uses the Spotify Connect Web API to show the currently playing track for a logged in user and give playback controls.
- Spotify Premium
- A developer app from the Spotify for Developers Dashboard
- XCode 9
- Cocoapods
This demo uses SpotifyLogin for authentication and authorization. This library is intended for prototyping purposes only and should not be used in production apps.
First, fork and clone this project to your machine.
- Register an app on the Spotify for Developers Dashboard.
- In the settings of your app, enter your iOS app's bundle ID and redirect URI (ie.
com.yourdomain.awesome-spotify-app://
)
- Run
pod repo update
andpod install
in the Terminal. - In the
AppDelegate
, look for the call toSpotifyLogin.shared.configure()
. Replace the placeholders with your client ID, secret, and redirect URI.
- Your top tracks are shown on the page. Show your top artists instead. (See
showTop()
) - Add a pause button and a play button. The functions are already implemented in the
SpotifyDataController
. (Seeprevious()
andnext()
) - Show the title and artist of the current track. (See
updateCurrentlyPlaying()
) - The top tracks endpoint allows you to choose out of 3 different time ranges,
short_term
,medium_term
(default), andlong_term
. Show your long term top tracks. (SeegetMyTop()
inSpotifyDataController
) - Use one of the other functions from
SpotifyDataController
to show data in your app. - Implement another endpoint from the Spotify API.