Log in with Spotify from your app in Swift

Introducing SpotifyLogin

Earlier this year, I joined Spotify as an iOS engineer and am spending much of my time improving the way our users enjoy music. It’s a super exciting mission for anyone passionate about technology and art and I hope to be able to share more about that work when it’s public.

Outside of the day-to-day work though I also run several popular open source Swift projects and enjoy speaking publicly about Swift. It’s only natural that one of my first public-facing side projects within Spotify will be a Swift library.

Hello SpotifyLogin

Today I’m proud to share with you SpotifyLogin, Spotify’s first pure Swift open source framework and the latest addition to our public SDKs.

SpotifyLogin takes care of the flow needed to obtain a Spotify API token. It’s built with the latest version of Swift and takes advantage of modern iOS standards while offering a significantly simplified API (taking into account lessons I learned from writing open source projects) and a signficantly smaller footprint than the corresponding part of the current Objective C SDK.

SpotifyLogin in action

How to use

SpotifyLogin can be installed via Cocoapods or Carthage and is as simple to use as:

On Spotify and Swift

Swift is the fastest growing programming language in the world and our existing Objective C SDK didn’t make life easy for Swift developers. The main objective of SpotifyLogin was to make it much easier to intgerate Spotify with Swift projects.

Our iOS engineers are passionate about Swift and our level of Swift usage is regularly evaluated at Spotify. We have several teams working fully with Swift. However, due to limitations of Xcode and past versions of the language, the majority of our work is still done in Objective C. This is likely to change with Swift 4 and XCode 9.

Until then, SpotifyLogin signals our commitment to a Swift-y future. We also use our SDKs internally to build mockups, prototypes and hacks and the hope is that this project (and future Swift projects within Spotify) will encourage more Spotify engineers to learn and practice their Swift skills.

Check it out on: