Skip to content

Commit

Permalink
Force callee to pass the context
Browse files Browse the repository at this point in the history
Setting this default forces a dependency on SuperCoreDataStack, it also encourages very bad practice via blase/naive management of
the context. The callee can still use this class, but should be forced to pass in the context. Related to michaelarmstrong#25
  • Loading branch information
rromanchuk committed Aug 22, 2015
1 parent 3dc3811 commit 338cbaf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion SuperRecord/NSFetchedResultsControllerExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public extension NSFetchedResultsController {
return superFetchedResultsController(entityName, sectionNameKeyPath: sectionNameKeyPath, sortDescriptors: sortDescriptors as [AnyObject], predicate:nil, delegate: delegate)
}

private class func superFetchedResultsController(entityName: String!, sectionNameKeyPath: String?, sortDescriptors: [AnyObject]?, predicate: NSPredicate?, delegate: NSFetchedResultsControllerDelegate, context: NSManagedObjectContext! = SuperCoreDataStack.defaultStack.managedObjectContext!) -> NSFetchedResultsController {
private class func superFetchedResultsController(entityName: String!, sectionNameKeyPath: String?, sortDescriptors: [AnyObject]?, predicate: NSPredicate?, delegate: NSFetchedResultsControllerDelegate, context: NSManagedObjectContext!) -> NSFetchedResultsController {

let fetchRequest = NSFetchRequest(entityName: entityName)
fetchRequest.entity = NSEntityDescription.entityForName(entityName, inManagedObjectContext: context)
Expand Down

0 comments on commit 338cbaf

Please sign in to comment.