Created
November 14, 2015 23:38
-
-
Save blixt/ae33b643467e9fa931be to your computer and use it in GitHub Desktop.
NSData hex extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSData { | |
var hex: String { | |
let pointer = UnsafePointer<UInt8>(self.bytes) | |
var hex = "" | |
for i in 0..<self.length { | |
hex += String(format: "%02x", pointer[i]) | |
} | |
return hex | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment