The error is telling you that as of iOS 12 the old UIImageJPEGRepresentation function has been replaced with the new jpegData method on UIImage.
Change:
let imageData = UIImageJPEGRepresentation(image, 0.75)
to:
let imageData = image.jpegData(compressionQuality: 0.75)
Similarly, the use of UIImagePNGRepresentation has been replaced with pngData().