0
私は、UserProfileノードからダッシュボードからいくつかの値を取得し、それらをグローバル変数に渡してobserve関数の外でグローバルに使用しようとしています。取得したノードの値を取得し、それらをグローバルに使用する! (FirebaseとSwift)
ref.child("UserProfile").child(FIRAuth.auth()!.currentUser!.uid).observeEventType(.Value , withBlock: {snapshot in
if let name = snapshot.value!.objectForKey("name") as? String {
print(name)
}
if let email = snapshot.value!.objectForKey("email") as? String {
print(email)
}
if let phone = snapshot.value!.objectForKey("phone") as? String {
print(phone)
}
if let city = snapshot.value!.objectForKey("city") as? String {
print(city)
}
})
observe関数の外に渡したいので、.swiftファイルのどこにでもそれらを使用できます。