Created
April 11, 2018 06:29
-
-
Save ratulSharker/5968e81bcdfdb8267312e0e1af26b2be to your computer and use it in GitHub Desktop.
Extension for converting an UIImage into Base64 String
This file contains 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
import UIKit | |
extension UIImage { | |
func base64EncodingString() -> String { | |
let imageData:Data = UIImagePNGRepresentation(self)! | |
return imageData.base64EncodedString() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment