The compare is a NSDate function. With Date you can just use < operator. For example:

alarms.sort { $0.time < $1.time }

Having said that, compare should work, too, though. I suspect there's some deeper issue here, that perhaps your time values have different dates. You might only be looking at the time portion, but when comparing Date objects, it considers both the date and time portions. If you only want to look at the time portion, there are several ways of doing that, for example, look at the time interval between time and the start of the day: