1

I'm following an online class (from December, 2016) and am getting the error in this screenshot.

error screenshot

Here's my code: // // FirebaseManager.swift

import UIKit
import Firebase
import FirebaseDatabase
import FirebaseAuth
import FirebaseAnalytics

class FirebaseManager: NSObject {
    static let databaseRef = FIRDatabase.database().reference()
    static var currentUserId:String = ""
    static var currentUser:FIRUser? = nil

    static func Login(email:String, password:String, completion: @escaping (_ success:Bool) ->
        Void) {
        FIRAuth.auth()?.signIn(withEmail: email, password: password, completion: { (user,error)
            in
        if let error = error {
            print(error.localizedDescription)
            completion(false)
        } else {
            curentUser = user
            currentUserId = (user?.uid)!
            completion(true)}
        })
    }
}

And here is the screenshot of the code from this example:code example from class

I've reviewed a few SO questions including this one but don't see an answer that applies to my situation. Please see my attachedmy swift version settings swift settings. Xcode version Attaching again as I don't see it. Swift Version settings

Thanks for your help

Community
  • 1
  • 1
Jazzmine
  • 1,837
  • 8
  • 36
  • 54

1 Answers1

0

Why are you using legacy Swift instead of Swift 3? The sample code you show is for Swift 3. The @escaping attribute was introduced in Swift 3, so that could explain the build error.

Jen Person
  • 7,356
  • 22
  • 30