Skip to content

Latest commit

 

History

History
57 lines (44 loc) · 1.57 KB

README.md

File metadata and controls

57 lines (44 loc) · 1.57 KB

FirebaseSwift

Build Status Language GitHub license

FirebaseSwift is intended for server-side Swift and acts as a wrapper around the Firebase REST api. Options for both synchronous and asynchronous calls.

Swift Package Manager

.Package(url: "https://github.com/gtchance/FirebaseSwift.git", majorVersion: 1, minor: 2)

Example

let firebase = Firebase(baseURL: "https://myapp.firebaseio.com/", auth: "mytoken")
GET
let users = firebase.get("user")
PUSH
let newUser = [
  "name": "John",
  "email": "[email protected]"
]
let response = firebase.push(path: "user", value: newUser)
print(response) // ["name": "john_id"]
PUT
let updatedUser = [
  "name": "John Smith",
  "email": "[email protected]"
]
// can also use setValue(path: ..., value: ...)
let response = firebase.put(path: "user/john_id", value: updatedUser) 
DELETE
firebase.delete("user/john_id")
PATCH
let response = firebase.patch(path: "user/john_id", value: ["middleInitial: "T"])

Refer to the following for documentation on the Firebase REST API: https://firebase.google.com/docs/reference/rest/database/

I AM NOT AFFILIATED WITH GOOGLE OR FIREBASE IN ANY WAY

If you experience any bugs, please create an issue or submit a pull request.