In my other app using Parse here I check if currentUser was nil, and if not segued past the LogInViewController. With the Pinterest SDK I can't find anywhere in the documentation where I can check for a currentUser.
What's the best way to structure this so that if the user had authorized already, performSegueWIthIdentifier, if not display this LogInViewController? I was thinking about saving the user's name to NSUserDefaults and then calling PDClient.sharedInstance().getUser(nameSavedToNSUD), and if success perform the segue but it seemed like a bit of hack and there has to be a better way?
import UIKit
class LogInViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func didPressLogInButton(sender: UIButton) {
let permission = [PDKClientReadPublicPermissions,
PDKClientWritePublicPermissions,
PDKClientReadPrivatePermissions,
PDKClientWritePrivatePermissions,
PDKClientReadRelationshipsPermissions,
PDKClientWriteRelationshipsPermissions]
PDKClient.sharedInstance().authenticateWithPermissions(permission,
withSuccess: { (responseObject :PDKResponseObject!) -> Void in
self.performSegueWithIdentifier("showBoards", sender: self)
}) { (err :NSError!) -> Void in
print("error NSError: \(err)")
}
}
}