Latest 0.1.9
Homepage https://github.com/starhoshi/LastfmClient
License MIT
Platforms ios 10.0
Dependencies APIKit
Authors

A Swifty last.fm api client using Codable.

Lastfm’s API is not very good. Nested Dictionary, Nonexistent key, etc.
If you use LastfmClient, you can handle last.fm api type-safely and Swifty.

TODO

  • [ ] User
    • [x] user.getTopTracks
    • [x] user.getRecentTracks
    • [x] user.getInfo
    • [ ] …
  • [ ] Track
  • [ ] Tag
  • [ ] Library
  • [ ] Geo
  • [ ] Chart
  • [ ] Auth
  • [ ] Artist
  • [ ] Album

Installation

pod install LastfmClient

Usage

import LastfmClient

Configuration.shared.configure(apiKey: "YOUR_LASTFM_API_KEY")
let user = UserAPI(user: "star__hoshi")
user.getInfo { result in
    switch result {
    case .success(let user):
        XCTAssertEqual(user.name, "star__hoshi")
    case .failure(let error):
        XCTFail("(error)")
    }
}

Test

  1. Get your lastfm api key from here.
  2. Add TestConfiguration.swift to LastfmClientTests.
    • Please copy TestConfiguration.sample.swift and use it.
    • Set lastfm api key.
  3. Run tests!

Latest podspec

{
    "name": "LastfmClient",
    "version": "0.1.9",
    "summary": "A Swifty last.fm api client using Codable.",
    "homepage": "https://github.com/starhoshi/LastfmClient",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "star__hoshi": "[email protected]"
    },
    "social_media_url": "https://twitter.com/star__hoshi",
    "platforms": {
        "ios": "10.0"
    },
    "source": {
        "git": "https://github.com/starhoshi/LastfmClient.git",
        "tag": "0.1.9"
    },
    "source_files": "LastfmClient/**/*.{swift}",
    "dependencies": {
        "APIKit": [
            "~> 3.1.1"
        ]
    }
}

Pin It on Pinterest

Share This