Sync

JSON to Core Data and back. Swift Core Data Sync.

OTHER License

Stars
2.6K
Committers
33

Bot releases are hidden (Show)

Sync - Sync — 3.3.0

Published by 3lvis over 7 years ago

  • Add Objective-C support for syncing changes using Sync operations

Options

@objc public enum CompatibleOperationOptions: Int {
    case insert = 0
    case update = 1
    case delete = 2
    case insertUpdate = 3
    case insertDelete = 4
    case updateDelete = 5
    case all = 6
}

APIs

class func compatibleChanges(_ changes: [[String: Any]], inEntityNamed entityName: String, dataStack: DataStack, operations: CompatibleOperationOptions, completion: ((_ error: NSError?) -> Void)?)
class func compatibleChanges(_ changes: [[String: Any]], inEntityNamed entityName: String, predicate: NSPredicate?, dataStack: DataStack, operations: CompatibleOperationOptions, completion: ((_ error: NSError?) -> Void)?)
Sync - Sync — 3.2.3

Published by 3lvis over 7 years ago

  • Make persistentStoreCoordinator public
Sync - Sync — 3.2.1

Published by 3lvis over 7 years ago

  • Re-added iOS 8 support
Sync - Sync — 3.2.1

Published by 3lvis over 7 years ago

  • Fix Swift 3.1 Warnings (Xcode 8.3)
Sync - Sync — 3.2.0

Published by 3lvis over 7 years ago

Updated Core Data Model user info keys

Added support for:

  • sync.remoteKey
  • sync.isPrimaryKey
  • sync.nonExportable
  • sync.valueTransformer

This is backwards compatible, the hyper ones still work.

Improved JSON export API

Besides hyp_dictionary now you'll get a export() method.

More info about exporting here.

Sync - Sync — 3.1.0

Published by 3lvis over 7 years ago

// For example now you can do
dataStack.sync(objectsB, inEntityNamed: "User", operations: [.update], completion: nil)

// Instead of
Sync.changes(objectsB, inEntityNamed: "User", dataStack: dataStack, operations: [.update], completion: nil)
Sync - Sync — 3.0.0

Published by 3lvis over 7 years ago

  • Bundled all the dependencies

Breaking changes

  • DATAStack renamed to DataStack
  • You might need to remove all your import DATAStack and replace it with import Sync
  • OperationOptions before .Insert, .Update, .Delete and .All, now .insert, .update, .delete and .all
Sync - Sync — 2.7.0

Published by 3lvis almost 8 years ago

Sync - Sync — 2.6.3

Published by 3lvis almost 8 years ago

  • Removed unused parameter from one of the sync methods

https://github.com/SyncDB/Sync/commit/34a90cc37c6695b85fb54e05f1a890bb0d21c208

Sync - Sync — 2.6.2

Published by 3lvis almost 8 years ago

  • Use Result type for NSPersistentContainer extension
persistentContainer.insertOrUpdate(json, inEntityNamed: "User") { result in
    switch result {
    case .success:
        // be happy
    case .failure(let error):
        // do something with error
    }
}
Sync - Sync — 2.6.1

Published by 3lvis almost 8 years ago

  • Improved NSPersistentContainer extension

Insert or update

persistentContainer.insertOrUpdate(json, inEntityNamed: "User") { id, error in
    //...
}

Update

persistentContainer.update("id", with: ["name": "bossy"], inEntityNamed: "User") { id, error in
    //...
}

Delete

persistentContainer.delete("id", inEntityNamed: "User") { error in
    //...
}
Sync - Sync — 2.6.0

Published by 3lvis almost 8 years ago

  • Adds a helper to use Sync as an extension of NSPersistentContainer
persistentContainer.sync(objects, inEntityNamed: "NormalUser") { error in
    //....
}
Sync - Sync — 2.5.0

Published by 3lvis almost 8 years ago

Fetch

let fetched = try! Sync.fetch("id", inEntityNamed: "User", using: dataStack.mainContext)

Insert or update

try! Sync.insertOrUpdate(["id": "id", "name": "name"], inEntityNamed: "User", using: context)

Update

try! Sync.update("id", with: ["name": "Elvis"], inEntityNamed: "User", using: context)

Delete

try! Sync.delete("id", inEntityNamed: "User", using: context)
Sync - Sync — 2.4.0

Published by 3lvis almost 8 years ago

This one couldn't be possible without the help from the fantastic @dersvenhesse! Thanks <3

  • Fix issue cleaning to-one relationship using ID https://github.com/SyncDB/Sync/issues/320
  • Add willInsert delegate. Called before the JSON is used to create a new NSManagedObject.
  • Add support for NSPersistentContainer
public class func changes(_ changes: [[String : Any]], inEntityNamed entityName: String, predicate: NSPredicate?, persistentContainer: NSPersistentContainer, completion: ((_ error: NSError?) -> Void)?) {
Sync - Sync — 2.3.4

Published by 3lvis almost 8 years ago

  • Renamed Sync.Operation to Sync.OperationOptions
  • Made Sync.OperationOptions options public
Sync - Sync — 2.3.3

Published by 3lvis almost 8 years ago

Add date format: 2016-10-10 07:00:00

Sync - Sync — 2.3.2

Published by 3lvis almost 8 years ago

  • Added Carthage support
  • Improved headers, now DATAFilter.Operation is Sync.Operation
Sync - Sync — 1.16.1

Published by 3lvis almost 8 years ago

💐 🎉 Thanks @ricardo0100 🎉 💐

Sync - Sync — 2.3.1

Published by 3lvis almost 8 years ago

💐 🎉 Thanks @ricardo0100 🎉 💐

Sync - Sync — 1.16.0

Published by 3lvis almost 8 years ago

  • Changed NSManagedObject_HYPPropertyMapper with SYNCPropertyMapper.

You might need to replace any:

import NSManagedObject_HYPPropertyMapper

With:

import SYNCPropertyMapper

And:

// Before
hyp_remote

// After
hyp_snakeCase
// Before
hyp_local

// After
hyp_camelCase
Package Rankings
Top 16.93% on Carthage
Top 1.36% on Cocoapods.org