Skip to content

katoemba/LastFMApi

Repository files navigation

bitrise CI platforms Swift Package Manager compatible

lastfm-api-swift

This package makes data from the last.fm api available via observables in Swift.

Usage

  let lastfm = LastFMApi(apiKey: apiKey)
  lastfm.info(artist: "Tame Impala")
      .subscribe(onNext: { (info) in
          print("Artist info: \(info)")
      })
      .disposed(by: bag)

Requirements

  • Xcode 11 or Swift Package Manager
  • Swift 5.0

Dependencies

lastfm-api-swift depends on RxSwift. To use the library, you will need a last.fm api key.

Testing

Unit tests are included. To run those, you have to set an environment variable for the last.fm api key. To run the tests from the command line, use the following command: LASTFM_API_KEY=YOURKEY swift test

Installation

Currently only build and usage via swift package manager is supported. The easiest way to add the library is directly from within XCode (11). Alternatively you can create a Package.swift file.

// swift-tools-version:5.0

import PackageDescription

let package = Package(
  name: "MyProject",
  dependencies: [
  .package(url: "https://github.com/katoemba/lastfm-api-swift.git", from: "0.0.1")
  ],
  targets: [
    .target(name: "MyProject", dependencies: ["LastFMApi"])
  ]
)