GithubHelp home page GithubHelp logo

firebaseparcelkit's Introduction

FirebaseParcelKit

FirebaseParcelKit integrates Core Data with Google Firebase Realtime Database. It is almost entirely based on Jonathan Younger's ParcelKit which was for the excellent but now-deprecated Dropbox Datastore.

Installation

FirebaseParcelKit can be added to a project using CocoaPods. We also distribute a framework build.

Using CocoaPods Badge w/ Version

// Podfile
pod 'FirebaseParcelKit', :git => "https://github.com/andygeers/FirebaseParcelKit"

and

pod install

Framework

  1. Open the ParcelKit.xcodeproj project
  2. Select the “Framework” scheme
  3. Build (⌘B) the Framework
  4. Open the Products section in Xcode, right click “libParcelKit.a”, and select “Show in Finder”
  5. Drag and drop the “ParcelKit.framework” folder into your iPhone/iPad project
  6. Edit your build settings and add -ObjC to “Other Linker Flags”

Usage

Include FirebaseParcelKit in your application.

#import <ParcelKit/ParcelKit.h>

Initialize an instance of the FirebaseParcelKit sync manager with the Core Data managed object context that we should be used for listening for changes from and writing changes to - as well as the globally unique user ID from Firebase Auth:

PKSyncManager *syncManager = [[PKSyncManager alloc] initWithManagedObjectContext:self.managedObjectContext userId:self.userId];

Associate the Core Data entity names with the corresponding Firebase database tables.

[syncManager setTable:@"books" forEntityName:@"Book"];

Start observing changes from Core Data and Firebase.

[syncManager startObserving];

Hold on to the sync manager reference.

self.syncManager = syncManager;

Set up Core Data

ParcelKit requires two extra attribute inside your Core Data model.

  • syncID with the type String. The Indexed property should also be checked.
  • isSynced with the type Boolean. The Indexed property should also be checked.
  • remoteSyncTimestamp with the type Int64. The Optional property should be checked and the default should be unchecked.

Make sure you add these attribute to each entity you wish to sync.

Alternative attribute names may be specifed by changing the syncAttributeName, isSyncedAttributeName and remoteTimestampAttributeName properties on the sync manager object.

Documentation

Example Application

  • Toado - Simple task manager demonstrating the integration of Core Data and Dropbox using ParcelKit.

Requirements

  • iOS 7.0 or higher
  • Google Firebase SDK 3.1.2 or higher
  • Xcode 5 or higher

License

MIT.

firebaseparcelkit's People

Contributors

daikini avatar andygeers avatar gavinbunney avatar

Watchers

 avatar

Forkers

maxlesichniy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.