NFSpotifyAuth 0.1.0

NFSpotifyAuth 0.1.0

Maintained by Neil Francis Ramirez Hipona, Neil Francis Ramirez Hipona.



NFSpotifyAuth

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Features

  • Spotify Authentication using WebOAuth

Requirements

  • iOS 13.0+
  • Xcode 11.0+

Installation

CocoaPods

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

pod 'NFSpotifyAuth'

Manually

  1. Download and drop /Pod/Classesfolder in your project.
  2. Congratulations!

Usage

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)")
    }
}

Author

Neil Francis Ramirez Hipona, [email protected]

License

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