I am trying to use the Realm query api in Swift to filter on the following Realm object:
public class Photo: Object {
@Persisted(primaryKey: true) var photoID: UUID
@Persisted(indexed: true) var remoteDateLastUpdated: Date?
@Persisted(indexed: true) var localDateLastUpdated: Date
}
Notice that the one of the Date
fields is optional and the other is not. I am trying to query this object like so:
let photosToPush = self.photos.where({
$0.remoteDateLastUpdated != $0.localDateLastUpdated
})
But I am getting the error Cannot convert value of type Query<Date> to expected argument type ‘Query<Date?>’
How can I typecast this to make this query work?