내가 가진 NSManagedObject
개체가 : 나는이 두 가지 사이의 시간 간격을 필요두 개의 'NSDate` 객체가있는`timeIntervalSince()`에`as Date'가 필요한 이유는 무엇입니까?
@NSManaged public var timestamp: NSDate
를, 그래서 구현 :
let interval = next.timestamp.timeIntervalSince(current.timestamp)
이유는 무엇입니까 다음과 같은 오류에서이 결과는?
'NSDate' is not implicitly convertible to 'Date'; did you mean to use
'as' to explicitly convert?
나는 next
과 current
두 유형 NSDate
의 때문에 놀랐어요, 그리고 timeIntervalSince()
는 NSDate
방법이다.
그것은 쉽게 오류의 제안에 따라 고정,하지만 난 여기에 무슨 이해하고 싶습니다 : 그것은 중요한
let interval = next.timestamp.timeIntervalSince(current.timestamp as Date)
경우,이 스위프트 3.0에 있습니다.