setupに関してはfirebaseの説明通りに進めばok
日本語+画像付きなのですごくわかりやすいです。
セットアップが完了したら、DBようの設定を追加します。
まず、podfileに以下を追加、pod updateを行う
pod 'Firebase/Database'
var databaseRef:FIRDatabaseReference = FIRDatabaseReference()//DB
//DB
databaseRef = FIRDatabase.database().reference()
読み込む
func readFbData() {
databaseRef.observeEventType(.ChildAdded, withBlock: { snapshot in
let id = snapshot.value!.objectForKey("id") as? String
}
})
}
保存
func saveFbData() {
let pokeData = ["id": "001", "no": "1"]
databaseRef.childByAutoId().setValue(pokeData)
}