Do you mean swift 4.2?
Call it like this yourImageObject.jpegData(compressionQuality: 0.5)
because function changed to public func jpegData(compressionQuality: CGFloat) -> Data?
For more syntax I have a repo you can take a reference with changes from swift 4. https://github.com/alexliubj/Swift-Migration-4.2
Updated:
This API change is from iOS 12, not Swift 4.2. Thanks @rmaddy for your correction.