I'm currently updating my project to Swift 3 and I'm moving all my NSDate methods and extensions to Date in order to keep the standard in the app.
The problem is that I use Xcode to auto-generate my NSManagedObject subclasses and it is generating the date attributes as NSDate instead of Date.
Is there a way to generate it with the date attributes as Date?
EDIT
Per Apple Developer Documentation:
Core Data natively supports a variety of attribute types, such as string, date, and integer (represented as instances of NSString, NSDate and NSNumber respectively).
So I think it's not possible =/
It's not currently possible, because Core Data is still very much tied to Objective-C types, and this is one of the places it shows.
However, you can still assign a
Date
to anNSDate
attribute:It's far from ideal, but if you have other code that uses
Date
, you don't have to make it useNSDate
instead. Useas
to convert only when working directly with your managed objects.