Skip to content
This repository has been archived by the owner on Jun 2, 2018. It is now read-only.

Convenience updates #119

Closed
wants to merge 5 commits into from

Conversation

darrarski
Copy link
Contributor

Added convenience methods for creating new or updating existing Entity objects.

extension CoreDataModelable where Self: NSManagedObject {
    static public func createInContext(context: NSManagedObjectContext, @noescape configure: Self -> ()) -> Self
    static public func updateInContext(context: NSManagedObjectContext, predicate: NSPredicate?, @noescape configure: Self -> ()) throws -> [Self]
    static public func updateOrCreateInContext(context: NSManagedObjectContext, predicate: NSPredicate?, @noescape configure: Self -> ()) throws -> [Self]
}

…configure, updateInContext:predicate:configure and updateOrCreateInContext:predicate:configure:
@rcedwards
Copy link
Contributor

Thank you for your contribution to the BNR Core Data Stack. As a team we see these changes as a solid addition to any individual project, however in a framework setting, it would broaden our public API in a way that may not benefit the majority of CoreDataStack users.

From a technical preservative these changes are spot on (terrific comments, accompanying tests, sound code) and this is simply a strategic decision.

If you happen to create a separate repository for this CoreDataModelable extension, we'd be more than happy to link to it from our Wiki as a CoreDataStack add-on.

Thanks again!

@rcedwards rcedwards closed this Apr 8, 2016
@jeremy-w
Copy link
Member

jeremy-w commented Apr 8, 2016

I've created an Add-Ons wiki page to collect add-ons.

@darrarski
Copy link
Contributor Author

Sure, I understand your point. Could you provide some hints about creating add-ons? Should it be managed by some dependency manager like CocoaPods?

@jeremy-w
Copy link
Member

jeremy-w commented Apr 8, 2016

I was thinking Carthage, but we could add a column for Pod name to that table to accommodate Podfiles, too.

I imagine people using their dependency manger of choice to pull in CoreDataStack + whatever sugar or extensions they'd like to have on top of it.

@rcedwards
Copy link
Contributor

https://github.com/spark/spark-sdk-ios might be a good reference for a repo that has a dependency that is listed in both a podspec and Cartfile.

Here is a smaller example with just a podspec for an add on to AFNetworking https://github.com/steipete/AFDownloadRequestOperation

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants