Skip to content

Commit 00b6113

Browse files
committed
Fixed build
1 parent 90ccf48 commit 00b6113

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:4.2
1+
// swift-tools-version:5.1
22

33
import PackageDescription
44

Source/Mac/NSImage+Extensions.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
#if canImport(AppKit)
12
import AppKit
3+
#endif
4+
5+
#if os(OSX)
26

37
/// Helper UIImage extension.
48
extension NSImage {
@@ -34,3 +38,5 @@ extension NSImage {
3438
.representation(using: imageFileType, properties: [:])
3539
}
3640
}
41+
42+
#endif

Source/iOS/UIImage+Extensions.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
#if canImport(UIKit)
12
import UIKit
3+
#endif
4+
5+
#if os(iOS) || os(watchOS) || os(tvOS)
26

37
/// Helper UIImage extension.
48
extension UIImage {
@@ -22,14 +26,9 @@ extension UIImage {
2226

2327
/// Convert to data
2428
func cache_toData() -> Data? {
25-
#if swift(>=4.2)
2629
return hasAlpha
2730
? pngData()
2831
: jpegData(compressionQuality: 1.0)
29-
#else
30-
return hasAlpha
31-
? UIImagePNGRepresentation(self)
32-
: UIImageJPEGRepresentation(self, 1.0)
33-
#endif
3432
}
3533
}
34+
#endif

0 commit comments

Comments
 (0)