To run the example project, clone the repo, and run pod install
from the Example directory first.
- Spotify Authentication using WebOAuth
- Mini Player View
- iOS 13.0+
- Xcode 11.0+
NFSpotifyAuth is available through CocoaPods. To install NFSpotifyAuth
, simply add the following line to your Podfile
:
pod 'NFSpotifyAuth'
- Download and drop
/Pod/Classes
folder in your project. - Congratulations!
NFSpotifyOAuth.shared.set(clientId: SpotifyClientID, clientSecret: SpotifyClientSecret, redirectURI: SpotifyCallbackURI)
let rectFrame = CGRect(x: 30, y: 80, width: view.frame.width - 60, height: 400)
let loginView = NFSpotifyLoginView(frame: rectFrame, scopes: NFSpotifyAvailableScopes, delegate: self)
view.addSubview(loginView)
loginView.show()
// mini player
let miniPlayer = NFSpotifyMiniPlayerView.instance(withDelegate: self)
let playerFrame = CGRect(x: 0, y: view.frame.height - miniPlayer.frame.size.height, width: view.frame.size.width, height: miniPlayer.frame.size.height)
view.addSubview(miniPlayer)
miniPlayer.updateFrame(playerFrame)
// MARK: - NFSpotifyLoginViewDelegate
extension ViewController {
func spotifyLoginViewDidShow(_ view: NFSpotifyLoginView) {
}
func spotifyLoginViewDidClose(_ view: NFSpotifyLoginView) {
}
func spotifyLoginView(_ view: NFSpotifyLoginView, didFailWithError error: Error?) {
print("err: \(error)")
}
func spotifyLoginView(_ view: NFSpotifyLoginView, didLoginWithTokenObject tObject: NFSpotifyToken) {
print("didLoginWithTokenObject: \(tObject)")
}
}
Neil Francis Ramirez Hipona, nferocious76@gmail.com
NFSpotifyAuth is available under the MIT license. See the LICENSE file for more info.