Latest 1.6.2
Homepage https://github.com/FireliteTeam/Firelite
License MIT
Platforms ios 8.0, osx 10.10, tvos 9.0, watchos 2.0
Authors

Build Status

pod ‘Firelite’

Object rules :

All your objects need to have an id as String

Relationship rules :

To one :

-entity :
-id : String
-attribut : Type
-object : id (of object relation )

To many :
-id : String
-attribut : Type
-objects :

  • id : true
  • id : true
    -etc…

Some use example : (look at https://github.com/FireliteTeam/FireliteExample)

let fireliteEntity = FireliteEntity()

let entities = ["User":"users",
                "Store":"stores",
                "Product":"products",
                "Operator":"operators"]

func syncCoredataToFirebase(){

    guard let context = self.context else { return }
    for entity in entities{

    ref.child(entity.value).observe(.childAdded, with: { (snapshot) in
        if let json = snapshot.value as? [String:Any]{
            self.fireliteEntity.coreDataSave(context: context, dictionnary: json, entityName: entity.key)
            try? self.context?.save()
        }
    })

    //Update coredata entity at each firebase modifications
    ref.child(entity.value).observe(.childChanged, with: { (snapshot) in
        if let json = snapshot.value as? [String:Any]{
            self.fireliteEntity.coreDataSave(context: context, dictionnary: json, entityName: entity.key)
            try? self.context?.save()
        }
    })

    //Delete coredata entity
    ref.child(entity.value).observe(.childRemoved, with: { (snapshot) in
        if let json = snapshot.value as? [String:Any]{
            self.fireliteEntity.coreDataSave(method: .delete, context: context, dictionnary: json, entityName: entity.key)
            try? self.context?.save()
        }
    })
    }
}

Latest podspec

{
    "name": "Firelite",
    "version": "1.6.2",
    "license": "MIT",
    "summary": "Firebase entities integration for Swift",
    "homepage": "https://github.com/FireliteTeam/Firelite",
    "authors": {
        "ESGI": "[email protected]"
    },
    "source": {
        "git": "https://github.com/FireliteTeam/Firelite.git",
        "tag": "1.6.2"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.10",
        "tvos": "9.0",
        "watchos": "2.0"
    },
    "source_files": "Firelite/*.swift"
}

Pin It on Pinterest

Share This