IOS8 Swift Base64 Conversion on Xcode 6.2
If you google search you will find many articles that have swift code to create Base64 encoded text. However Swift keeps changing and if you copy and paste the code, it just won’t run.
“my plain data” >>> “bXkgcGxhaW4gZGF0YQ==” (base64)
let plainString = "my plain data" let plainData = (plainString as NSString).dataUsingEncoding(NSUTF8StringEncoding) let base64String = plainData?.base64EncodedStringWithOptions(NSDataBase64EncodingOptions(0)) println(base64String!)
If this stop working, please leave a comment below.
openanalytics 3358 views
iOS Swift
Next Post
Convert a UITableviewController to a UIViewController
Technology
avi ( )
very nice article!
very helpfull.
i used this web site for testing:
http://ebase64encode.org/