Friday, June 24, 2016

Modern Core Data With Swift

Daniel Eggert:

We have used protocol and protocol extensions to make our code more readable.

We have also used a few other tricks, but the main gist is that you can create small helpers in your code to make your life easier, and make life easier for other people that have to read your code. Using old APIs is great because they have been battle-tested; it is code that has been around for many years… and, for many years, bugs have been fixed. But we can make these APIs even better (and make our lives easier).

When we create these helpers, it is important to keep the spirit of the original implementation. We want to make it easy for other people who read the code, and that who may not know about these wrappers.

1 Comment RSS · Twitter


There is many clever tricks in that presentation.

Note though that the 'KeyCodeable' part can is no longer required in Swift 3, as there is now a #keyPath() "function" that permit to reference property in a safe way (without the need to redeclare all properties in an enum).

Leave a Comment