Categories
Uncategorized

last.fm integration through swift

The upcoming release of Rigelian will focus on the artist view: a more image based view, improved handling of artist images and the addition of artist biographies and similar artists.

Biographies and similar artists will be retrieved from last.fm, which offers an api for this. To abstract the networking part I created a new package that encapsulates the api calls into nice observables.

let lastfmApi = LastFMApi(apiKey:"your key")
lastfmApi.info(artist: "Taylor Swift")
  .subscribe({ onNext: (result) in
     switch result {
       case let .success(info):
         print("Info: \(info)"
       case .failure(error):
         print("Error: \(error)")
     }
  })
  .disposed(by: bag)
 

The package is available on GitHub: https://github.com/katoemba/lastfm-api-swift