I am getting an error while converting my code to Swift 3.0. My sample code is below:
func hexRepresentation()->String {
let dataLength:Int = self.count
let string = NSMutableString(capacity: dataLength*2)
let dataBytes:UnsafeRawPointer = (self as NSData).bytes
for idx in 0..<dataLength {
string.appendFormat("%02x", [UInt(dataBytes[idx])] as String )
}
return string as String
}