2016-04-26 7 views
0

Firebaseリクエストからどのように応答するのですか? たとえば、子カウント値を取得したら関数を開始します。Firebaseリクエストから値を受け取った後に関数を呼び出す

let FAref = Firebase(url: "https://my-app.firebaseio.com/Users/\(uid!)/Data") 


    FAref.observeEventType(FEventType.Value, withBlock: { (snapshot) -> Void in 


     if snapshot != nil { 

      self.count = Int(snapshot.childrenCount) 

     } 


    }) { (error) -> Void in 
     print(error.description) 
    } 
+0

は何を正確に何をしたいですか? –

+0

一度私はself.count = Int(snapshot.childrenCount)を得る 関数を呼び出す –

+0

そして、それをやめることからあなたは何を止めていますか? 'self.count'を設定した直後に関数を呼び出すことができます。 –

答えて

0
let FAref = Firebase(url: "https://my-app.firebaseio.com/Users/\(uid!)/Data") 


    FAref.observeEventType(FEventType.Value, withBlock: { (snapshot) -> Void in 


     if snapshot != nil { 

      let count = Int(snapshot.childrenCount) 

      //Just add the function call after you get the childrenCount 
      self.myFunction(count) 
     } 


    }) { (error) -> Void in 
     print(error.description) 
    } 
関連する問題