I don't know whether it is a bug or a feature but sorting array of enums give different result with each run. Here is a basic code to test it.
enum Tag: String {
case bold, italic, underline
}
extension Tag: Comparable {
static func <(lhs: Tag, rhs: Tag) -> Bool {
return lhs.hashValue < rhs.hashValue
}
}
let tags:[Tag] = [.bold, .italic, .underline].sorted()
print(tags.map {$0.rawValue})