Skip to content

Instantly share code, notes, and snippets.

@zsim0n
Created September 7, 2015 04:45
Show Gist options
  • Save zsim0n/592eba07f52b5116076b to your computer and use it in GitHub Desktop.
Save zsim0n/592eba07f52b5116076b to your computer and use it in GitHub Desktop.
Convert text to Base64 - Swift
func textFieldShouldReturn(textField: UITextField) -> Bool {
urlField.resignFirstResponder()
let data = urlField.text!.dataUsingEncoding(NSUTF8StringEncoding)
let urlFieldBase64 = data?.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.Encoding64CharacterLineLength)
return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment