diff --git a/Demo.xcodeproj/project.pbxproj b/Demo.xcodeproj/project.pbxproj index 90eb25d..044fb1c 100755 --- a/Demo.xcodeproj/project.pbxproj +++ b/Demo.xcodeproj/project.pbxproj @@ -1059,6 +1059,7 @@ MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; + SWIFT_VERSION = 2.3; }; name = Debug; }; @@ -1097,6 +1098,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 2.3; VALIDATE_PRODUCT = YES; }; name = Release; diff --git a/Sources/NetworkingImage.swift b/Sources/NetworkingImage.swift index b3dfe07..dbd1982 100644 --- a/Sources/NetworkingImage.swift +++ b/Sources/NetworkingImage.swift @@ -32,7 +32,11 @@ extension NetworkingImage { func pngData() -> NSData? { #if os(OSX) - return self.data(type: .PNG) + #if swift(>=2.3) + return self.data(type: .PNG) + #else + return self.data(type: .NSPNGFileType) + #endif #else return UIImagePNGRepresentation(self) #endif @@ -40,7 +44,11 @@ extension NetworkingImage { func jpgData() -> NSData? { #if os(OSX) - return self.data(type: .JPEG) + #if swift(>=2.3) + return self.data(type: .JPEG) + #else + return self.data(type: .NSJPEGFileType) + #endif #else return UIImageJPEGRepresentation(self, 1) #endif