Skip to content

Instantly share code, notes, and snippets.

@codelynx
Created January 17, 2024 20:28
Show Gist options
  • Save codelynx/e4a544a880eea77386345ea46964a1e1 to your computer and use it in GitHub Desktop.
Save codelynx/e4a544a880eea77386345ea46964a1e1 to your computer and use it in GitHub Desktop.
utility extension convert UnsafePointer<UInt8> to String?
extension UnsafePointer<UInt8> {
var string: String? {
return String(validatingUTF8: UnsafeRawPointer(self).assumingMemoryBound(to: CChar.self))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment