UIImageJPEGRepresentation not available in swift 5 || Image to data conversion in swift

Solution:

In swift 4 we can use the below code to convert the image to data

Swift 4:

 UIImageJPEGRepresentation(savingImage, 0.5)

swift 5:

savingImage.jpegData(compressionQuality: 0.5)

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift