Run FirebaseLoginViewController with Swift

0

After the announcement that it will close in January of next year. I have decided to use Firebase. The good thing is that my App is still in development and had not advanced much, however one of the parts that had already been proven was the authentication. I used PFLogInViewController at the time to make my life easier but now with Firebase I'm trying to use FirebaseLoginViewController that works in a very similar way, both classes (FirebaseLoginViewController and PFLogInViewController) inherit from UIViewController and at least in parse it was very easy to customize it. In firebase there is not much documentation about it and I'm giving myself bumps.

This is what I have at the moment.

import UIKit
class AccesoPrincipal : FirebaseLoginViewController{



override func viewDidLoad() {
    super.viewDidLoad()

    let firebaseRef = Firebase(url: "https://superaapp.firebaseio.com/")

    self.loginViewController = FirebaseLoginViewController(ref: firebaseRef)
    self.loginViewController.enableProvider(FAuthProvider.Facebook)
    //self.loginViewController.enableProvider(FAuthProvider.Google)
    //self.loginViewController.enableProvider(FAuthProvider.Twitter)
    self.loginViewController.enableProvider(FAuthProvider.Password)
    // Scenario 1: Set up captive portal login flow
    self.loginViewController.didDismissWithBlock { (user: FAuthData, error: NSError) -> Void in
        if (user) {
            // Handle user case
        } else if (error) {
            // Handle error case
        } else {
            // Handle cancel case
        }
    }



// Scenario 1: Application launches login flow, handles dismissal and routing in 'didDismissWithBlock:'
override func viewDidAppear(animated: Bool) {
    if (!self.loginViewController.currentUser()) {
        self.presentViewController(self.loginViewcontroller, animated: true, completion: nil)
    }
}



override func logout() {
    if (self.loginViewController.currentUser()) {
        self.loginViewController.logout()
    }
}

}

I have taken the previous code fragment from the FirebaseUi-IOS documentation itself link and I have been giving bumps with the errors.

My pod install file

   platform :ios, '9.2'

pod 'Firebase'
pod 'FirebaseUI', '~> 0.3'

my header.h file, where I do not know if I'm invoking FirebaseLoginViewController correctly

    #ifndef Header_h
#define Header_h


#endif /* Header_h */
#import <FirebaseLoginViewController.h>
#import <Firebase/Firebase.h>
    
asked by Víctor Gonzal 15.02.2016 в 21:46
source

1 answer

1

The problem that I see a priori is the following:

This should be:

var loginViewController: FirebaseLoginViewController?

Since as you put it, after the : the type should go.

    
answered by 15.02.2016 / 22:38
source