I have an Objective-C class which contains an NSDate *createdTime
property. When using an object of this class from Swift, accessing createdTime
and assigning it to a variable of type Date
results in nil
being assigned to the variable. This behavior can also be seen in LLDB, where p createdTime
prints nil
but po createdTime
prints the date:
(lldb) p obj.createdTime
(Date?) $R60 = nil
(lldb) po obj.createdTime
▿ Optional<Date>
▿ some : 2015-04-07 14:05:29 +0000
- timeIntervalSinceReferenceDate : 450108329.0
(lldb) p (obj.createdTime as NSDate?)
(NSDate?) $R66 = some {
some = 0x803059aa219d0795 2015-04-07 14:05:29 UTC
}
(lldb) p (obj.createdTime as NSDate?) as Date?
(Date?) $R68 = nil
What is going on?