I am creating and using time base UUID for items. I am using this function:
class func timeBasedUUID() -> NSUUID {
let uuidSize = sizeof(uuid_t)
let uuidPointer = UnsafeMutablePointer<UInt8>.alloc(uuidSize)
uuid_generate_time(uuidPointer)
let uuid = NSUUID(UUIDBytes: uuidPointer)
uuidPointer.dealloc(uuidSize)
return uuid
}
And now I would like to know how can I sort them from oldest to newest. I was thinking about comparing strings but it is correct? Because I don't think so.