Skip to content

Instantly share code, notes, and snippets.

@clarkeben
Last active September 6, 2023 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clarkeben/ac9e6fcc6607f24c8fbb5a2294e43b41 to your computer and use it in GitHub Desktop.
Save clarkeben/ac9e6fcc6607f24c8fbb5a2294e43b41 to your computer and use it in GitHub Desktop.
Swift Strings
let data = Data("Hello, world!".utf8)
let string = String(data: data, encoding: .utf8)
let string = "Hello, world!"
let optionalData = string.data(using: .utf8) ///"Optional(13 bytes)
let string = "Hello, world!"
let data = Data(string.utf8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment