Search code examples
core-dataxcdatamodel

What type should be used to store year property in Core Data?


I thought of Integer 16, because it's easy to calculate years, depending from it.

String is good for searching, for ex. it's easy to find year 78 as substring from 1978. And it's also possible to keep year as Date.

What's the best practice?


Solution

  • I'll stay with Integer 16, because it's the way how it's done in the book "CoreData for iOS".