Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Introduction to Core Data with Swift 2 Understanding the Core Data Stack The Core Data Stack

eberhapa
eberhapa
51,495 Points

Different implementations for CoreData in the Swift3 version for Facesnap and TodoList

Hi folks, Hi Pasan Premaratne

There are two different implementations for the CoreDataController in the Swift3 project files for the Facesnap and the TodoList application. Which one is correct? Both are working so what are the differences?

Thanks, Patrick

1 Answer

Pasan Premaratne
STAFF
Pasan Premaratne
Treehouse Teacher

Hey eberhapa

There is no one correct way to create a Core Data helper so to your first question the answer is neither :) If they both work they are both good candidates. The files for TodoList were written by a different teacher so they vary from mine but you can use either one.

It's been a while since I looked at those courses so let me take a look and get back to you on differences

eberhapa
eberhapa
51,495 Points

Alright. The TodoList version is the same code which apple provides when creating a new project with CoreData. Your way is the more specific and customizable, am i right?

Thanks

Pasan Premaratne
Pasan Premaratne
Treehouse Teacher

Yeah in general we try to remove things from the AppDelegate so it doesn't clutter the class up with several responsibilities. For what its worth, this is already different in Swift 3 so the code certainly needs updating.