什么类型是Auth.auth()

时间:2018-04-15 17:56:55

标签: ios swift firebase firebase-authentication

我正在尝试通过创建Firebase DataService来干扰我的应用,但我不知道要为Auth.auth()投射什么类型。我查看了源代码定义,但它在Objective C中,我不明白。是否可以提取Auth.auth()?

这就是我所拥有的:

let FB_AUTH = Auth.auth()
let DB_BASE = Database.database().reference()
let FB_STORAGE = Storage.storage().reference()

class FBData {
    static let fbi = FBData()

    //MARK: PROPERTIES
    private var _FB_AUTH = FB_AUTH
    private var _REF_BASE = DB_BASE
    private var _STORAGE_BASE = FB_STORAGE
    private var _REF_USERS = DB_BASE.child("users")

    //MARK: PRIVATE GETTERS
    var FB_AUTH: NSObject {
        return _FB_AUTH
    }

    var REF_BASE: DatabaseReference {
        return _REF_BASE
    }

    var STORAGE_BASE: StorageReference
    {
        return _STORAGE_BASE
    }

    var REF_USERS: DatabaseReference {
        return _REF_USERS
    }
}

1 个答案:

答案 0 :(得分:2)

正如你所说,看看源头,我看到了:

+ (FIRAuth *)auth NS_SWIFT_NAME(auth());

(FIRAuth *)是返回类型。因此Auth.auth()的类型为FIRAuth(Swift中的Auth),它继承自NSObject

NS_SWIFT_NAME(Auth)
@interface FIRAuth : NSObject