Nora is a Firebase abstraction layer for FirebaseDatabase and FirebaseStorage

Overview

codebeat badge Build Status Swift Xcode MIT Contributions Welcome Open Source Love


Nora is a Firebase abstraction layer for working with FirebaseDatabase and FirebaseStorage.

Stop spending all that time cleaning up your view controllers and trying to write reusable Firebase code.

Let Nora handle that for you. Your time is better spent on what you do best. Writing great Apps!

Simply put, working with Firebase just got whole lot easier.


Installation

CocoaPods Recommended

  pod 'Nora'

Example

Working with FirebaseDatabase

After setting up a target making requests is simple.

let database = DatabaseProvider<Users>()

database.request(.getUser(id: "1")) { result in
  switch result {
  case .success(let response):
    let snapshot = response.snapshot
  case .failure(let error):
    print(error.localizedDescription)
  }
}

Database Response Decoding

Provide a JSON initializer for your custom types and easily convert the database response:

let database = DatabaseProvider<Users>()

database.request(.getUser(id: "1")) { result in
  switch result {
  case .success(let response):
    let user = try? response.mapTo(User.init)
  case .failure(let error):
    print(error.localizedDescription)
  }
}

Working with FirebaseStorage

let storage = StorageProvider<Avatars>()
let avatarData = Data()
var meta = FIRStorageMetadata?

storage.request(.upload(avatarData, meta)) { result in
  switch result {
  case .success(_):
    print("Upload Success!")
  case .failure(let error):
    print(error.localizedDescription)
  }
}

Documentation (In Progress)

DatabaseTarget Documentation

DatabaseProvider Documentation


Get involved

You can contribute to this project in more ways than just code:

  • Improving the README
  • Improving Documentation
  • Bug reporting
  • New feature suggestions
  • Answering questions

We really encourage everyone to get involved in open source.

Your feedback is always welcome and much appreciated!

REGARDLESS, of your level of experience.

You will never be put down for having an opinion. So take a chance, open a pull request, or submit that issue!


Inspiration

This project was inspired and based off the Moya networking abstraction layer in Swift.

Check out their project if you're using traditional networking!


License

Nora is released under an MIT license. See LICENSE.md for more information.

Comments
  • Fix error ' initializer is inaccessible d…">

    Fix error "'NRDatabaseProvider' initializer is inaccessible d…

    I got this error with Swift 4 'NRDatabaseProvider<Target>' initializer is inaccessible due to 'internal' protection level I solved in this way. Am I implemeting on a bad way?

    Thanks

    opened by alexkater 7
  • [#10] fix travis

    [#10] fix travis

    Should be passing now. Problem was that you were not linking pod dependencies for xcodebuild. I am not sure but I think you could reconsider using cocoapods for dependencies management. Doing so probably makes it impossible for people not using cocoapods to use your lib. Carthage is more lightweight tool for it since it only fetched the binary dependencies build and does not change your xcode project settings at all.

    opened by pawurb 3
  • What is the pro and cons Nora vs pyrobase?

    What is the pro and cons Nora vs pyrobase?

    first, thanks for writing the library and second

    What is the pro and cons Nora vs pyrobase? trying to understand which one is better fit for one scenario and not the others.

    https://github.com/mownier/pyrobase

    question 
    opened by steve21124 2
  • Update for latest version of Firebase

    Update for latest version of Firebase

    Needs an update to new version of Firebase

    • [x] Resolve naming convention conflicts by adding NR prefix
    • [x] Update to new Firebase API
    • [x] Update Podfile to new FirebaseDatabase & FirebaseStorage versions
    new firebase release 
    opened by SD10 2
  • Add flatMapChildrenTo and flatMapTo methods under DatabaseResponse extensions

    Add flatMapChildrenTo and flatMapTo methods under DatabaseResponse extensions

    Reasoning:

    Since mapTo and mapChildrenTo are throwing methods it can be inconvenient to have to either force unwrap or use a do-catch block to obtain a non-optional value.

    enhancement 
    opened by SD10 1
  • Fix Nora project name and badge alignment in README

    Fix Nora project name and badge alignment in README

    This pull request contains alignment related fix for README.md.

    Align Nora header name to center. Align different badge to center under the Nora project name. The complete fix is inspired from the Instagram IGListKit README.md file.

    opened by tapanprakasht 1
  • Correct the spelling of CocoaPods in README

    Correct the spelling of CocoaPods in README

    This pull request corrects the spelling of CocoaPods 🤓 https://github.com/CocoaPods/shared_resources/tree/master/media

    Created with cocoapods-readme.

    opened by ReadmeCritic 1
  • Update to Firebase 3 & Fix Naming Collisions

    Update to Firebase 3 & Fix Naming Collisions

    Summary of Pull Request:

    This is a continuation of #21.

    API Breaking

    This pull request updates Nora to FirebaseDatabase 4.0.0 & FirebaseStorage 2.0.0. There were significant naming collisions because of Firebase dropping the FIR prefix. Now all Nora types are prefixed with NR.

    new firebase release 
    opened by SD10 0
  • Use baseReference when String path is empty #19

    Use baseReference when String path is empty #19

    Summary of Pull Request:

    • Implements the changes discussed in #19
    • If path property of DatabaseTarget or StorageTarget is an empty String, a child path will not be applied and the baseReference will be used instead.
    opened by SD10 0
  • Add check for empty string path when building the DatabaseRequest

    Add check for empty string path when building the DatabaseRequest

    Reasoning:

    Currently, you can't use an empty String for the path property of DatabaseTarget in order to default to using the baseReference. This can be easily be fixed by adding a check for an empty string and only calling child(path:) on the baseReference if the String is not empty.

    enhancement 
    opened by SD10 0
  • Add FIRDatabaseQuery support, response key mapping, optional completion

    Add FIRDatabaseQuery support, response key mapping, optional completion

    Enhancements

    • Remove required completion block for request #12 (considering throwing fatalError() if completion is not supplied for read request)
    • Add mapKey(_ key:) method to DatabaseResponse
    • Add support FIRDatabaseQuery #13

    Other

    • No API breaking changes unless you have been using the development branch
    opened by SD10 0
  •  Update DatabaseQuery API

    Update DatabaseQuery API

    Update DatabaseQuery API

    The queries property of DatabaseTarget is currently an array of DatabaseQuery. I really never liked this interface and think it would be more user-friendly if it were a linked list.

    enhancement starter task 
    opened by SD10 0
  • Use Jazzy to auto-generate documentation

    Use Jazzy to auto-generate documentation

    We just installed Jazzy over @SwifterSwift and it's been an awesome experience. I'd like to do the same for this repository. It will be much easier to maintain that markdown docs.

    enhancement 
    opened by SD10 0
Releases(1.1.1)
Owner
Steven Deutsch
❤️ Open Source | iOS & Swift @Fundrise
Steven Deutsch
Analytics layer abstraction, abstract analytics reporters and collect domain-driven analytic events.

?? Tentacles Current State: Work in Progress Documentation & Tests(100% completed, but needs refactoring and structuring) started but not done yet, im

Patrick 3 Dec 2, 2022
Safe and easy wrappers for common Firebase Realtime Database functions.

FirebaseHelper FirebaseHelper is a small wrapper over Firebase's realtime database, providing streamlined methods for get, set, delete, and increment

Quan Vo 15 Apr 9, 2022
SQLite.swift - A type-safe, Swift-language layer over SQLite3.

SQLite.swift provides compile-time confidence in SQL statement syntax and intent.

Stephen Celis 8.7k Jan 3, 2023
A lightweight wrapper over UserDefaults/NSUserDefaults with an additional layer of AES-256 encryption

SecureDefaults for iOS, macOS Requirements • Usage • Installation • Contributing • Acknowledgments • Contributing • Author • License SecureDefaults is

Victor Peschenkov 216 Dec 22, 2022
A food delivery app using firebase as the database.

FDA-ONE Food Delivery Application is a mobile application that users can use to find the best restaurant around their location and order the meals the

Naseem Oyebola 0 Nov 28, 2021
Synco - Synco uses Firebase's Realtime Database to synchronize data across multiple devices, in real time

Synco Synco uses Firebase's Realtime Database to synchronize a color across mult

Alessio 0 Feb 7, 2022
Prephirences is a Swift library that provides useful protocols and convenience methods to manage application preferences, configurations and app-state. UserDefaults

Prephirences - Preϕrences Prephirences is a Swift library that provides useful protocols and convenience methods to manage application preferences, co

Eric Marchand 557 Nov 22, 2022
Classes-and-structures-in-swift - This source files show what is the difference between class and structure

This source files show what is the difference between class and structure You ca

null 0 Jan 4, 2022
Elegant library to manage the interactions between view and model in Swift

An assistant to manage the interactions between view and model ModelAssistant is a mediator between the view and model. This framework is tailored to

Seyed Samad Gholamzadeh 28 Jan 29, 2022
Store and retrieve Codable objects to various persistence layers, in a couple lines of code!

tl;dr You love Swift's Codable protocol and use it everywhere, who doesn't! Here is an easy and very light way to store and retrieve Codable objects t

null 149 Dec 15, 2022
Disk is a powerful and simple file management library built with Apple's iOS Data Storage Guidelines in mind

Disk is a powerful and simple file management library built with Apple's iOS Data Storage Guidelines in mind

Saoud Rizwan 3k Jan 3, 2023
KeyPathKit is a library that provides the standard functions to manipulate data along with a call-syntax that relies on typed keypaths to make the call sites as short and clean as possible.

KeyPathKit Context Swift 4 has introduced a new type called KeyPath, with allows to access the properties of an object with a very nice syntax. For in

Vincent Pradeilles 406 Dec 25, 2022
StorageManager - FileManager framework that handels Store, fetch, delete and update files in local storage

StorageManager - FileManager framework that handels Store, fetch, delete and update files in local storage. Requirements iOS 8.0+ / macOS 10.10+ / tvOS

Amr Salman 47 Nov 3, 2022
Listens to changes in a PostgreSQL Database and via websockets.

realtime-swift Listens to changes in a PostgreSQL Database and via websockets. A Swift client for Supabase Realtime server. Usage Creating a Socket co

Supabase 35 Dec 1, 2022
An Objective-C wrapper for RocksDB - A Persistent Key-Value Store for Flash and RAM Storage.

ObjectiveRocks ObjectiveRocks is an Objective-C wrapper of Facebook's RocksDB - A Persistent Key-Value Store for Flash and RAM Storage. Current RocksD

Iskandar Abudiab 56 Nov 5, 2022
Simple, Strongly Typed UserDefaults for iOS, macOS and tvOS

简体中文 DefaultsKit leverages Swift 4's powerful Codable capabilities to provide a Simple and Strongly Typed wrapper on top of UserDefaults. It uses less

Nuno Dias 1.4k Dec 26, 2022
Safe and easy wrappers for RealmSwift

RealmWrapper RealmWrapper is wrapper library for RealmSwift in realm-cocoa If you use RealmWrapper, you can easily use UI update through Notification

DongHee Kang 72 Nov 1, 2022
A protocol-centric, type and queue safe key-value workflow.

Light-weight, strict protocol-first styled PropertyKit helps you to easily and safely handle guaranteed values, keys or types on various situations of

gitmerge 12 Feb 26, 2021
An efficient, small mobile key-value storage framework developed by WeChat. Works on Android, iOS, macOS, Windows, and POSIX.

中文版本请参看这里 MMKV is an efficient, small, easy-to-use mobile key-value storage framework used in the WeChat application. It's currently available on Andr

Tencent 15.4k Jan 6, 2023