-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SuperCoreStack should be 100% decoupled from NSFetchedResultsControllerExtension #25
Comments
The callee CAN be responsible for sending the MOC, but if you don't it will default back to another. However, this pattern will change soon as i'm developing a new pattern for this area (see issue: #22 ). In regards to calling back up to the delegate, would you prefer the receiver sets the delegate on a returned object from that method manually? If you could could write up a quick 10 line example of your suggestion it'd help. |
@michaelarmstrong the problem is with the actual default, I don't include that class in my project. I actually like |
This is my usage lazy var fetchedResultsController: NSFetchedResultsController = NSFetchedResultsController.superFetchedResultsController("Post", sectionNameKeyPath: nil, sortDescriptors: self.sortDescriptors, predicate: self.predicate, tableView: self.tableView, context: self.managedObjectContext) |
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
This extension is a great class, but it needs to be decoupled.
https://github.com/michaelarmstrong/SuperRecord/blob/master/SuperRecord/NSFetchedResultsControllerExtension.swift#L102
We use a more advanced stack so this line gives us problems. In general it's probably better to force the callee to be responsible for sending the MOC, always. In general calling back up to the delegate for the moc is bad practice, especially when there isn't just a single MOC being used everywhere.
The text was updated successfully, but these errors were encountered: