Latest 0.1.0
Homepage https://github.com/MobileDevelopersOfBerkeley/FirebaseUtils
License MIT
Platforms ios 8.0
Authors

This is a simple Swift class that provides easy methods to query data from your Firebase Database.

This library allows users to treat their default tree structure database in Firebase as a relational database (similar to the usage of Parse).

All that is needed is to create your FIRDatabaseReference then pass it as a parameter into one of our functions to retrieve your desired data.

It includes the following query methods:

  • queryById
  • queryByStringContains
  • queryByListContains
  • queryByListContainsSublist
  • queryByNotEqualTo
  • queryByLessThan
  • queryByLessThanOrEqualTo
  • queryByGreaterThan
  • queryByGreaterThanOrEqualTo

Installation with CocoaPods

Makre sure you’re on the correct repo branch: ‘FirebaseUtilsCocoaPod’

Install FirebaseUtils with: CocoaPods

Podfile

pod 'FirebaseUtils'

How to use

First import Firebase and FirebaseAuth to your selected ViewController.

import Firebase
import FirebaseAuth

To sign into Firebase:

FIRAuth.auth()?.signIn(withEmail: "[email protected]", password: "password", completion: nil)

Create your desired reference where you want to pull the data from:

let ref = FIRDatabase.database().reference(withPath: "users")

Create a variable to reference our FirebaseUtils:

let firebaseUtils = FirebaseUtils()

Create a block variable in which you determine what you want to do with the resulting object, such as print, return, etc.
(in this example, the object is being printed):

let block = { object -> Void in
            print(object)
        }

Use the firebaseUtils variable and block variable as a parameter to call any one of our functions above
(in this example, queryByStringContains is being called):

firebaseUtils.queryByStringContains(fieldName: "image", ref: ref, inputValue: "https://www.example.com", withBlock: block)

More Info

View our FirebaseUtils.swift file for more specifics on each function, the required parameters, and what results will be returned.

Support

Supports iOS 8 and above. Xcode 7.0 is required to build the latest code written in Swift 3.0.

Latest podspec

{
    "name": "FirebaseUtils",
    "version": "0.1.0",
    "summary": "A simple Swift class with easy methods to query data from your Firebase Database.",
    "description": "This library allows users to treat their default tree structure database in Firebase as a relational database (similar to the usage of Parse).",
    "homepage": "https://github.com/MobileDevelopersOfBerkeley/FirebaseUtils",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Christine Munar": "[email protected]"
    },
    "source": {
        "git": "https://github.com/MobileDevelopersOfBerkeley/FirebaseUtils.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "FirebaseUtils/Classes/**/*",
    "pushed_with_swift_version": "echo "3.0" > .swift-version"
}

Pin It on Pinterest

Share This