small medium large xlarge

24 Jan 2017, 21:32
Mitch Cohen (3 posts)

I’m confused about the two main project folders in the new (Swift 3) sample code. I’m primarily looking at PPRDataController.swift at the moment.

The PPRRecipesV3/PPRDataController.swift file handles errors and calls the completion block when an error occurs. But in the event of success, that completion block is never called. This seems…weird to me.

The PPRRecipes/PPRDataController.swift file handles errors with fatalError, but the completion block is called on success as I’d expect.

I don’t see mention of PPRRecipes in the book, so I’m unsure of the reason for the two versions. There are a few other differences too, like an “import UIKit” in V3, but the above seem to be the most pertinent differences. Is there a “correct” or “more complete” version? Or is there a book reference I’m missing?


24 Jan 2017, 21:37
Marcus S. Zarra (284 posts)


Thank you for your feedback. The various projects in the sample code match up to the chapters in the book and the V3 sample has more examples in it than the PPRRecipes sample.

In either case they are not intended to be 100% fully functional, ready to ship applications. Both projects demonstrate parts of Core Data and how they fit together.

I would not classify either as more complete, but examples illustrating different points.

I hope that helps and feel free to post any specific questions you have with regard to the code examples. Swift has been evolving very quickly and it is quite possible the samples missed something during the 3 revisions that happened while the book was being written :)

24 Jan 2017, 22:04
Mitch Cohen (3 posts)

Thanks for the clarification - understood.

You must be logged in to comment