Turns out - since Date
is of type Comparable
, you can use a (Closed)Range
with generics to create a DateRange
.
I also tried with using a Set<Date>
, because you can create a Set
from a Range
but not a ClosedRange
😞
Using a Set
I ran into problems fairly quick - also tried with a NSOrderedSet
but you can't init
it with a Range
.
Range
and ClosedRange
can’t be iterated over (they are not collections anymore),
since a value that is merely Comparable
cannot be incremented. CountableRange
and CountableClosedRange
require Strideable
from their bound
and they conform to Collection
so that you can iterate over them.
TODO:
- Make this
Strideable
- Make this a
Collection