In Obj-C I used to convert an unsigned integer n to a hex string with
NSString *st = [NSString stringWithFormat:@\"%2X\", n];
I tried for
To use
let string2 = String(format:"%02X", 1) print(string2) // prints: "01"
In Swift3 import foundation is not required, At least not in a Project. String should have all the functionality as NSString.