Closed dhiraj closed 6 years ago
Encoding/Decoding functions are implemented for Tagged values. In your case, you may use the following code:
let deviceUUID = UIDevice.current.identifierForVendor!.uuidString.replacingOccurrences(of: "-", with: "")
let deviceUUIDByteString = NSByteString(deviceUUID)
let tag = NSTag(tag: 37, deviceUUIDByteString)
let encoded = CBOR.encode(tag)
print(Data(bytes: encoded!).hex)
You can check the result of print....
using cbor.me tools.
Thanks, this is very helpful!
It would be awesome if you added support for UUIDs as per https://github.com/lucas-clemente/cbor-specs/blob/master/uuid.md
I'm willing to code support myself, tried using the custom tag support as well but couldn't. Please help, thanks!
I'm able to get a UUID's representation as [UInt8] but I can't figure out what to do next after that.