Latest 0.4
Homepage https://github.com/svenbacia/iTunesSearchAPI
License MIT
Platforms ios 8.4, osx 10.10, tvos 9.0, watchos 2.0, requires ARC

CI Status
codecov
Version
License
Platform
Carthage compatible

Simple wrapper for the iTunes Search API written in Swift.

Usage

Basics

To be able to use the iTunes Search API wrapper you need an iTunes client.

iTunes(session: URLSession = URLSession.shared, debug: Bool = false)

When debug is enabled, you get some information about the url which will be requested.

Search

For the most basic search you only have to provide a search term and a completion handler. The result of the search will be passed as a Result containing either the successfully decoded JSON or a SearchError.

itunes.search(for: "Castle") { result in
  // handle the Result<Any, SearchError>
}

Specified Media Type

When you are looking for something specific you can add a specific media type.

itunes.search(for: "Castle", ofType: .tvShow(.tvSeason)) { result in
  // handle the Result<Any, SearchError>
}

Each Media type can take an additional parameter of type Entity. This entity parameter specifies the return type. In the example above we are only looking for TV Seasons of the show Castle.

Lookup

Similar to the search you can use the lookup function. The lookup function takes a LookupType and a completion handler.

itunes.lookup(by: .id("12345")) { result in
  // handle the Result<Any, SearchError>
}

Options

Both search() and lookup() can take an addtitional parameter of type Option. There you can specify information like limit, language or country.

Requirements

  • Swift 3.0
  • iOS 8.4
  • watchOS 2
  • tvOS 9.0
  • OSX 10.10

Installation

Carthage

github "svenbacia/iTunesSearchAPI"

Cocoapods

iTunesSearchAPI is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "iTunesSearchAPI"

Manually

You can also add the specific target manually to your project.

Author

Created and maintained by @svenbacia

License

iTunesSearchAPI is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "iTunesSearchAPI",
    "version": "0.4",
    "license": "MIT",
    "summary": "Simple iTunes Search API wrapper",
    "homepage": "https://github.com/svenbacia/iTunesSearchAPI",
    "social_media_url": "https://twitter.com/svenbacia",
    "authors": "Sven Bacia",
    "source": {
        "git": "https://github.com/svenbacia/iTunesSearchAPI.git",
        "tag": "0.4"
    },
    "source_files": "Source/*.swift",
    "platforms": {
        "ios": "8.4",
        "osx": "10.10",
        "tvos": "9.0",
        "watchos": "2.0"
    },
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This