https://github.com/scottrhoyt/cider
The Missing Apple Music SDK. Written in Swift.
https://github.com/scottrhoyt/cider
apple apple-music-api carthage cocoapods music swift swift-package-manager
Last synced: 11 days ago
JSON representation
The Missing Apple Music SDK. Written in Swift.
- Host: GitHub
- URL: https://github.com/scottrhoyt/cider
- Owner: scottrhoyt
- License: mit
- Created: 2017-08-01T23:12:06.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-10-19T09:36:25.000Z (over 5 years ago)
- Last Synced: 2024-11-10T15:26:24.884Z (6 months ago)
- Topics: apple, apple-music-api, carthage, cocoapods, music, swift, swift-package-manager
- Language: Swift
- Homepage:
- Size: 1.54 MB
- Stars: 57
- Watchers: 7
- Forks: 16
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Cider
The Missing Apple Music SDK. Written in Swift.[](https://travis-ci.org/scottrhoyt/Cider)
[](https://codecov.io/github/scottrhoyt/Cider?branch=master)
[](https://github.com/Carthage/Carthage)
[](https://cocoapods.org/pods/Cider)
[](https://github.com/apple/swift-package-manager)

[](https://swift.org)### Installation
#### Carthage
Add the following to your Cartfile:
```sh
github "scottrhoyt/Cider" ~> 0.10
```#### CocoaPods
Add the following to your Podfile:
```sh
pod 'Cider', '~> 0.10'
```#### SPM
Add to your `Package.swift` file like so:
```swift
import PackageDescriptionlet package = Package(
name: "",
dependencies: [
.package(url: "https://github.com/scottrhoyt/Cider.git", from: "0.10.0")
]
)
```### Usage
#### Developer Token
To use the Apple Music API, you will need to generate a developer token.
Instructions for how to do this can be found in the Apple Music API
[reference](https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/AppleMusicWebServicesReference/SetUpWebServices.html#//apple_ref/doc/uid/TP40017625-CH2-SW1).Once you have an Apple Music Key you can use a 3rd party library/tool to
generate your token. I created a Node.js library and CLI tool that you can find
[here](https://github.com/scottrhoyt/apple-music-jwt).#### Create a Client
```swift
let developerToken = ""
let cider = CiderClient(storefront: .unitedStates, developerToken: developerToken)
```#### Search the Catalog
```swift
cider.search(term: "Michael Jackson", types: [.albums, .songs]) { results, error in
// Process the results or error
}
```#### Lookup an Artist/Album/Song
```swift
let songId = ""
cider.song(id: songId) { result, error in
// Process the results or error
}
```### API Reference
The full API reference can be found [here](https://scottrhoyt.github.io/Cider).
### License
MIT