16
Book 3: Mastering Xcode and Swift / Re: mmBiz, Relationships & other musings.
« on: January 25, 2016, 10:18:12 AM »
Carlos,
I made a few changes to your Task class so it works properly.
1. First of all, for the sake of clarity, I renamed the taskEntity property to taskEntityList, so it's more obvious that the property contains a list of entities rather than a single entity.
2. I changed the code in the getTasksForList() method so it stores the results in the taskEntityList property before returning the results. This matches the pattern in the getAllTaskEntities() method:
Q1. When do the ListEntity's "tasks" NSSet gets populated? or does ListEntity remain clueless and it simply trickles up the chain? isn't this like a SQL join?
It's similar in concept to a SQL join. You're asking the Task object to return a list of tasks for a specific list.
Q2. All CRUD functions only take place in the Entity Business Controller, yes? this separation of responsibility is it considered MVVM?
It's a more straightforward MVC (Model View Controller) design pattern.
Q3. Can the mmBiZObj be in the backgroundContext? -- I understand that CRUD must happen in the same Context to avoid confusing CoreData.
Yes, it can
Q4. I know am getting ahead of myself, ReactiveCocoa/RxReactive sounds seductive, could mmBiZObj peacefully coexist? I couldn't find your POV article on ReactiveCocoa.
I haven't worked with ReactiveCocoa, though I've read up on it. That said, mmBizObj can peacefully coexist with ReactiveCocoa.
Q5. Ohh yeah, can I use mmBiZObj or a variation of thereof in a production app?
Absolutely.
All the best!
Kevin
I made a few changes to your Task class so it works properly.
1. First of all, for the sake of clarity, I renamed the taskEntity property to taskEntityList, so it's more obvious that the property contains a list of entities rather than a single entity.
2. I changed the code in the getTasksForList() method so it stores the results in the taskEntityList property before returning the results. This matches the pattern in the getAllTaskEntities() method:
Code: [Select]
// Get all items for this List
func getTasksforList(listEntity: ListEntity) -> Array<T> {
let predicate = NSPredicate(format: "list = %@", listEntity)
// KJM - Store result in array before returning it
self.taskEntityList = self.getEntitiesMatchingPredicate(predicate)
return self.taskEntityList
}
Q1. When do the ListEntity's "tasks" NSSet gets populated? or does ListEntity remain clueless and it simply trickles up the chain? isn't this like a SQL join?
It's similar in concept to a SQL join. You're asking the Task object to return a list of tasks for a specific list.
Q2. All CRUD functions only take place in the Entity Business Controller, yes? this separation of responsibility is it considered MVVM?
It's a more straightforward MVC (Model View Controller) design pattern.
Q3. Can the mmBiZObj be in the backgroundContext? -- I understand that CRUD must happen in the same Context to avoid confusing CoreData.
Yes, it can
Q4. I know am getting ahead of myself, ReactiveCocoa/RxReactive sounds seductive, could mmBiZObj peacefully coexist? I couldn't find your POV article on ReactiveCocoa.
I haven't worked with ReactiveCocoa, though I've read up on it. That said, mmBizObj can peacefully coexist with ReactiveCocoa.
Q5. Ohh yeah, can I use mmBiZObj or a variation of thereof in a production app?
Absolutely.
All the best!
Kevin