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 — 1.6.6

Published by 3lvis over 8 years ago

Updated to DATAStack 5.0.0

Release notes from DATAStack here:

  • Refactored all the things to have better error handling and better code coverage
  • Added a new method to create a background context, super useful when doing saves with NSOperations
public func newBackgroundContext() -> NSManagedObjectContext

BREAKING CHANGE

  • Removed the need to call persistWithCompletion or persist, you just need to save your used context and magic will happen
// Just kill this babies, they are no longer needed
dataStack.persist {error in
}

dataStack.persistWithCompletion {

}
  • Now drop() throws, before it was hiding the error message but now you can deal with that. If you're an Objective-C user this will no work for you, use forceDrop() instead

Before:

dataStack.drop()

After:

try dataStack.drop()
Sync - Sync — 1.6.5

Published by 3lvis over 8 years ago

Thanks to @xTheRamon for reporting this issue 👏

Sync - Sync — 1.6.4

Published by 3lvis over 8 years ago

Sync - Sync — 1.6.3

Published by 3lvis over 8 years ago

  • Converted forced unwrapped optionals into fatalErrors for better crash reporting
Sync - Sync — 1.6.2

Published by 3lvis over 8 years ago

Updated NSManagedObject-HYPPropertyMapper — 3.6.0, which now includes support for transformable types. Make sure to check the relevant pull request for more information.

@AlexKel kicks ass.

giphy-1

Sync - Sync — 1.6.1

Published by 3lvis over 8 years ago

  • Updated DATAStack containing fix for TestCheck not working fine in Xcode 7.3

Thanks @wh33ler, you rock!

Previously in 1.6.0

AUTOMATIC SUPPORT FOR CAMELCASE MAPPINGS!

🎉 🎉 OMG OMG OMG 🎉 🎉

This comes thanks to @wainglaister who added this feature to NSManagedObject-HYPPropertyMapper. Fuck yeah!

15bb05b8-fe45-11e5-9af6-c8d2479db503

Sync - Sync — 1.6.0

Published by 3lvis over 8 years ago

AUTOMATIC SUPPORT FOR CAMELCASE MAPPINGS!

🎉 🎉 OMG OMG OMG 🎉 🎉

This comes thanks to @wainglaister who added this feature to NSManagedObject-HYPPropertyMapper. Fuck yeah!

15bb05b8-fe45-11e5-9af6-c8d2479db503

Sync - Sync — 1.5.4

Published by 3lvis over 8 years ago

  • Updated NSManagedObject-HYPPropertyMapper dependecy to 3.4.3
Sync - Sync — 1.5.3

Published by 3lvis over 8 years ago

  • Updated for Swift 2.2
Sync - Sync — 1.5.2

Published by 3lvis over 8 years ago

  • Fixed an issue with using an entity that has multiple many-to-many relationships.

For example:

This comes thanks to the fantastic @wainglaister in #179. 👏 👏 👏 👏 👏 👏

Sync - Sync — 1.5.1

Published by 3lvis over 8 years ago

  • Update DATAStack dependency

DATAStack — 4.1.0

  • Added support for having your data stores with different names, before if your model was Model.momd then your data store would have been Model.sqlite.

Use the following initalizer to make use of this feature:

public init(modelName: String, bundle: NSBundle, storeType: DATAStackStoreType, storeName: String)
  • Added support for versioning out of the box, and also fix a crash when there is no .momd file but a single .mom file.
Sync - Sync — 1.5.0

Published by 3lvis over 8 years ago

  • Added an additional Sync method.
class func changes(changes: [[String : AnyObject]], inEntityNamed entityName: String, predicate: NSPredicate?, parent: NSManagedObject?, inContext context: NSManagedObjectContext, dataStack: DATAStack, completion: ((error: NSError?) -> Void)?)

This method is useful to control even more parts of Sync, for example if you want to use a special context that triggers notifications when an object gets changed.

For example:

self.dataStack.performInNewBackgroundContext { backgroundContext in
    NSNotificationCenter.defaultCenter().addObserver(self, selector: "changeNotification:", name: NSManagedObjectContextObjectsDidChangeNotification, object: backgroundContext)

    Sync.changes(json["data"] as! Array, inEntityNamed: "Data", predicate: nil, parent: nil, inContext: backgroundContext, dataStack: self.dataStack, completion: { error in
        NSNotificationCenter.defaultCenter().removeObserver(self, name: NSManagedObjectContextObjectsDidChangeNotification, object: nil)
        completion(error)
    })
}
Sync - Sync — 1.4.3

Published by 3lvis over 8 years ago

  • Updated dependencies with more nullability marks and with support for decimal number
Sync - Sync — 1.4.2

Published by 3lvis over 8 years ago

  • Fixes a crash when mapping to-many ordered relationships (#176)
Sync - Sync — 1.4.1

Published by 3lvis over 8 years ago

1.4.1

In the API side of things, not much happened. We just hided a method that shouldn't have been exposed. Poor method.

Overall, we included documentation for ALL the methods, it might not be better than Apple's but it's a start. Apples to apples 🔫 🚪 .

Besides that, not all Sync should be in Swift, even the unit tests and helper methods.

Finally, the demo projects where moved to different repositories.

Previously in 1.4.0

A few critical parts of Sync were migrated to Swift, thanks to this now we have more type safety. Meaning, if something it's going on then Sync will either let you know at compiler time or just crash earlier, pointing the exact place where things didn't went as expected. For example if your relationships is missing a inverse relationship, now you will know that the problem is that, since now we have nullability marks everywhere.

First of all, you might need to update your Podfile, since now Sync includes some Swift code it's going to require you to add use_frameworks!. So now your Podfile will look like this:

use_frameworks!

pod 'Sync'

Now, let's continue with the other changes:

For Objective-C users, instead of using #import now you are going to have to use modules:

// Before
#import "Sync.h" 

// After
@import Sync; 

For Swift users, now the compiler is going to require you that your changes are [[String : AnyObject]] since that's what Sync requires, if you were already doing that then, no changes for you!

// Before
public class func changes(changes: NSArray, inEntityNamed entityName: String, dataStack: DATAStack, completion: ((error: NSError?) -> Void)?)

// After
public class func changes(changes: [[String : AnyObject]], inEntityNamed entityName: String, dataStack: DATAStack, completion: ((error: NSError?) -> Void)?)

Again, this is not really an API change, the API is really the same one as before. Everything is just a little bit safer.

Have a great day!

Sync - Sync — 1.4.0

Published by 3lvis over 8 years ago

A few critical parts of Sync were migrated to Swift, thanks to this now we have more type safety. Meaning, if something it's going on then Sync will either let you know at compiler time or just crash earlier, pointing the exact place where things didn't went as expected. For example if your relationships is missing a inverse relationship, now you will know that the problem is that, since now we have nullability marks everywhere.

First of all, you might need to update your Podfile, since now Sync includes some Swift code it's going to require you to add use_frameworks!. So now your Podfile will look like this:

use_frameworks!

pod 'Sync'

Now, let's continue with the other changes:

For Objective-C users, instead of using #import now you are going to have to use modules:

// Before
#import "Sync.h" 

// After
@import Sync; 

For Swift users, now the compiler is going to require you that your changes are [[String : AnyObject]] since that's what Sync requires, if you were already doing that then, no changes for you!

// Before
public class func changes(changes: NSArray, inEntityNamed entityName: String, dataStack: DATAStack, completion: ((error: NSError?) -> Void)?)

// After
public class func changes(changes: [[String : AnyObject]], inEntityNamed entityName: String, dataStack: DATAStack, completion: ((error: NSError?) -> Void)?)

Again, this is not really an API change, the API is really the same one as before. Everything is just a little bit safer.

Have a great day!

Sync - Sync — 1.3.0

Published by 3lvis almost 9 years ago

This is a nice one. Thanks to @tpmullan we got support for JSONs that only include the id of the relationship instead of the full JSON!

You can read more about this feature in the one-to-one simplified section in the README.

Also you can find the main issue that pointed to this: https://github.com/hyperoslo/Sync/issues/140

And a couple of more issues that mentioned this: https://github.com/hyperoslo/Sync/issues/139 https://github.com/hyperoslo/Sync/issues/64

This is a pretty safe change, so nothing would need to change in your part, is just that Sync now is more awesome.

Have a great weekend and thanks again to @tpmullan!

Sync - Sync — 1.2.2

Published by 3lvis almost 9 years ago

  • Update DATAStack dependency (the latest release just includes an update to TestCheck 0.3.0
Sync - Sync — 1.2.1

Published by 3lvis almost 9 years ago

  • Updated DATAStack with a fix for a crash when running on the Apple TV.

Previously on 1.2.1

  • Updated dependencies to support watchOS, OS X and tvOS.

Most dependencies only had minor changes, mostly adding support to the new platforms.

# https://github.com/3lvis/DATAFilter/releases/tag/0.9.1
s.dependency 'DATAFilter', '~> 0.9.1'

# https://github.com/3lvis/DATAStack/releases/tag/4.0.1
s.dependency 'DATAStack', '~> 4.0.1'

# https://github.com/3lvis/NSDictionary-ANDYSafeValue/releases/tag/0.3.1
s.dependency 'NSDictionary-ANDYSafeValue', '~> 0.3.1'

# https://github.com/hyperoslo/NSEntityDescription-SYNCPrimaryKey/releases/tag/0.1.1
s.dependency 'NSEntityDescription-SYNCPrimaryKey', '~> 0.1.1'

# https://github.com/hyperoslo/NSManagedObject-HYPPropertyMapper/releases/tag/3.3.3
s.dependency 'NSManagedObject-HYPPropertyMapper', '~> 3.3.3'

The biggest change relays in DATAStack which was rewritten in Swift.

This are the breaking changes:

Breaking changes in DATAStack 4.0.0

  • Now you should use modules, so instead of #import "DATASource.h you would do @import DATASource;
  • Renamed Enum + Improved Swift compatibility

Objective-C: Change DATAStackInMemoryStoreType to DATAStackStoreTypeInMemory, and change DATAStackSQLiteStoreType to DATAStackStoreTypeSQLite.

Swift: Change DATAStackInMemoryStoreType to .InMemory, and change DATAStackSQLiteStoreType to .SQLite.

Sync - Sync — 1.2.0

Published by 3lvis almost 9 years ago

  • Updated dependencies to support watchOS, OS X and tvOS.

Most dependencies only had minor changes, mostly adding support to the new platforms.

# https://github.com/3lvis/DATAFilter/releases/tag/0.9.1
s.dependency 'DATAFilter', '~> 0.9.1'

# https://github.com/3lvis/DATAStack/releases/tag/4.0.1
s.dependency 'DATAStack', '~> 4.0.1'

# https://github.com/3lvis/NSDictionary-ANDYSafeValue/releases/tag/0.3.1
s.dependency 'NSDictionary-ANDYSafeValue', '~> 0.3.1'

# https://github.com/hyperoslo/NSEntityDescription-SYNCPrimaryKey/releases/tag/0.1.1
s.dependency 'NSEntityDescription-SYNCPrimaryKey', '~> 0.1.1'

# https://github.com/hyperoslo/NSManagedObject-HYPPropertyMapper/releases/tag/3.3.3
s.dependency 'NSManagedObject-HYPPropertyMapper', '~> 3.3.3'

The biggest change relays in DATAStack which was rewritten in Swift.

This are the breaking changes:

Breaking changes in DATAStack 4.0.0

  • Now you should use modules, so instead of #import "DATASource.h you would do @import DATASource;
  • Renamed Enum + Improved Swift compatibility

Objective-C: Change DATAStackInMemoryStoreType to DATAStackStoreTypeInMemory, and change DATAStackSQLiteStoreType to DATAStackStoreTypeSQLite.

Swift: Change DATAStackInMemoryStoreType to .InMemory, and change DATAStackSQLiteStoreType to .SQLite.

Package Rankings
Top 16.93% on Carthage
Top 1.36% on Cocoapods.org