I'm having an issue while working with dates in Xcode11 and even on Xcode11.1. The debugger (somehow) contradicts itself.
You see, when I print the details for selectedRanges (which is a list of DateRanges with two properties:)
struct DateRange: Equatable {
var start: Date
var end: Date?
}
it shows me the correct values stored, but when I do something like this:
let a = selectedRanges.filter({
guard $0.isComplete() == true else { return false }
guard !date.isBetween($0.start, and: $0.end!) else { return false }
guard let firstSelectedRange = selectedRanges.first, firstSelectedRange.isComplete() == false else { return false }
*guard firstSelectedRange.start > $0.start && date < $0.start else { return false }
return true
})
and print firstSelecteRange.end
I get an optional value out of no were, and when tested with != nil
it returns a value and when tested with .isComplete()
returns another one (isComplete method is in the image).
All prints have been done on the *line from the code.
Weirdly enough, in the debugger console I get nil sometimes on ranges that are not.
My question is: is this an issue on Xcode, or do I miss something?