We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 05c6fca + d7d73bc commit 1664e8aCopy full SHA for 1664e8a
1 file changed
Source/iOS/UIImage+Extensions.swift
@@ -22,8 +22,14 @@ extension UIImage {
22
23
/// Convert to data
24
func cache_toData() -> Data? {
25
+ #if swift(>=4.2)
26
return hasAlpha
- ? self.pngData()
27
- : self.jpegData(compressionQuality: 1.0)
+ ? pngData()
28
+ : jpegData(compressionQuality: 1.0)
29
+ #else
30
+ return hasAlpha
31
+ ? UIImagePNGRepresentation(self)
32
+ : UIImageJPEGRepresentation(self, 1.0)
33
+ #endif
34
}
35
0 commit comments