Firebase

Firebase

Language
Swift
Category
3
Version
9.3.0
Authors
Google
Description
Firebase is an app development platform with tools to help you build, grow and monetize your app. More information about Firebase can be found on the official Firebase website.
Install Instructions
  • For a detailed installation guide, please visit the documentation at the bottom of this page.
  • You'll need to create an account with Firebase in order to get access to the config file and your API key.
  • After you've created your Firebase account and followed the setup instructions, you need to initialize Firebase in your app
// [UIApplicationDelegate File]
import FirebaseCore
import FirebaseFirestore
import FirebaseAuth
// ...
  • Next, configure a FirebaseApp shared instance:
// [UIApplicationDelegate File]
application(_:didFinishLaunchingWithOptions:) {
// Use Firebase library to configure APIs
FirebaseApp.configure()
// ...
}
Usage
  • These are simple, example uses of Firebase data retrieval:
override func viewWillAppear(_:) {
// 1
let completed = ref.observe(.value) { snapshot in
// 2
var newItems: [GroceryItem] = []
// 3
for child in snapshot.children {
// 4
if
let snapshot = child as? DataSnapshot,
let groceryItem = GroceryItem(snapshot: snapshot) {
newItems.append(groceryItem)
}
}
// 5
self.items = newItems
self.tableView.reloadData()
}
// 6
refObservers.append(completed)
}
Links