From 3d122e550b906aebb690a57f97fa3b211ed4ccf8 Mon Sep 17 00:00:00 2001 From: Bogdan Poplauschi Date: Fri, 10 Jun 2016 07:28:09 +0300 Subject: [PATCH] WatchOS support - just added a target and the conditional compiling - seems to work (pod lib lint works). There is an issue, the SDWebImage watchOS target doesn't show the simulator, only Generic Device. Also need to add some demo and test code. --- SDWebImage.podspec | 4 +- SDWebImage.xcodeproj/project.pbxproj | 190 +++++++++++++++++- .../xcschemes/SDWebImage watchOS.xcscheme | 80 ++++++++ .../xcshareddata/WorkspaceSettings.xcsettings | 8 + .../FLAnimatedImageView+WebCache.h | 3 + .../FLAnimatedImageView+WebCache.m | 3 + SDWebImage/SDImageCache.m | 11 +- SDWebImage/SDWebImageCompat.h | 21 +- SDWebImage/SDWebImageCompat.m | 4 + SDWebImage/SDWebImageDownloaderOperation.m | 8 +- SDWebImage/UIButton+WebCache.h | 4 + SDWebImage/UIButton+WebCache.m | 4 + SDWebImage/UIImage+GIF.h | 3 + SDWebImage/UIImage+GIF.m | 10 +- SDWebImage/UIImageView+HighlightedWebCache.h | 4 + SDWebImage/UIImageView+HighlightedWebCache.m | 4 + SDWebImage/UIImageView+WebCache.h | 4 + SDWebImage/UIImageView+WebCache.m | 4 + SDWebImage/UIView+WebCacheOperation.h | 4 + SDWebImage/UIView+WebCacheOperation.m | 4 + 20 files changed, 351 insertions(+), 26 deletions(-) create mode 100644 SDWebImage.xcodeproj/xcshareddata/xcschemes/SDWebImage watchOS.xcscheme create mode 100644 SDWebImage.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/SDWebImage.podspec b/SDWebImage.podspec index 5f64d5a..f205158 100644 --- a/SDWebImage.podspec +++ b/SDWebImage.podspec @@ -3,6 +3,8 @@ Pod::Spec.new do |s| s.version = '3.8.1' s.ios.deployment_target = '7.0' s.tvos.deployment_target = '9.0' + s.watchos.deployment_target = '2.0' + s.license = 'MIT' s.summary = 'Asynchronous image downloader with cache support with an UIImageView category.' s.homepage = 'https://github.com/rs/SDWebImage' @@ -36,7 +38,7 @@ Pod::Spec.new do |s| end s.subspec 'GIF' do |gif| - gif.ios.deployment_target = '6.0' + gif.ios.deployment_target = '7.0' gif.source_files = 'SDWebImage/FLAnimatedImage/*.{h,m}' gif.dependency 'SDWebImage/Core' gif.dependency 'FLAnimatedImage', '~> 1.0' diff --git a/SDWebImage.xcodeproj/project.pbxproj b/SDWebImage.xcodeproj/project.pbxproj index 477ddd7..af5c9cf 100644 --- a/SDWebImage.xcodeproj/project.pbxproj +++ b/SDWebImage.xcodeproj/project.pbxproj @@ -267,6 +267,40 @@ 431739591CDFC8B70008FEB9 /* mux.h in Headers */ = {isa = PBXBuildFile; fileRef = DA577CC81998E60B007367ED /* mux.h */; }; 4317395A1CDFC8B70008FEB9 /* mux_types.h in Headers */ = {isa = PBXBuildFile; fileRef = DA577CC91998E60B007367ED /* mux_types.h */; }; 4317395B1CDFC8B70008FEB9 /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = DA577CCA1998E60B007367ED /* types.h */; }; + 431BB68C1D06D2C1006A3455 /* SDWebImageDownloaderOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 530E49E416460AE2002868E7 /* SDWebImageDownloaderOperation.m */; }; + 431BB68E1D06D2C1006A3455 /* SDWebImagePrefetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D92148C56230056699D /* SDWebImagePrefetcher.m */; }; + 431BB6901D06D2C1006A3455 /* FLAnimatedImageView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 43CE75CF1CFE98E0006C64D0 /* FLAnimatedImageView+WebCache.m */; }; + 431BB6921D06D2C1006A3455 /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D5B9141188EE8DD006D06BD /* NSData+ImageContentType.m */; }; + 431BB69A1D06D2C1006A3455 /* SDWebImageDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D8C148C56230056699D /* SDWebImageDownloader.m */; }; + 431BB6A31D06D2C1006A3455 /* UIImageView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D96148C56230056699D /* UIImageView+WebCache.m */; }; + 431BB6AA1D06D2C1006A3455 /* SDWebImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D8F148C56230056699D /* SDWebImageManager.m */; }; + 431BB6AC1D06D2C1006A3455 /* SDWebImageCompat.m in Sources */ = {isa = PBXBuildFile; fileRef = 5340674F167780C40042B59E /* SDWebImageCompat.m */; }; + 431BB6B11D06D2C1006A3455 /* UIView+WebCacheOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = AB615302192DA24600A2D8E9 /* UIView+WebCacheOperation.m */; }; + 431BB6B41D06D2C1006A3455 /* SDWebImageDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D8A148C56230056699D /* SDWebImageDecoder.m */; }; + 431BB6B61D06D2C1006A3455 /* UIImage+WebP.m in Sources */ = {isa = PBXBuildFile; fileRef = 53EDFB921762547C00698166 /* UIImage+WebP.m */; }; + 431BB6B91D06D2C1006A3455 /* UIButton+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D94148C56230056699D /* UIButton+WebCache.m */; }; + 431BB6BD1D06D2C1006A3455 /* UIImage+GIF.m in Sources */ = {isa = PBXBuildFile; fileRef = A18A6CC6172DC28500419892 /* UIImage+GIF.m */; }; + 431BB6C01D06D2C1006A3455 /* SDImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D86148C56230056699D /* SDImageCache.m */; }; + 431BB6C41D06D2C1006A3455 /* UIImage+MultiFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = 53EDFB8917623F7C00698166 /* UIImage+MultiFormat.m */; }; + 431BB6C71D06D2C1006A3455 /* UIImageView+HighlightedWebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = ABBE71A618C43B4D00B75E91 /* UIImageView+HighlightedWebCache.m */; }; + 431BB6D71D06D2C1006A3455 /* UIImage+WebP.h in Headers */ = {isa = PBXBuildFile; fileRef = 53EDFB911762547C00698166 /* UIImage+WebP.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6D91D06D2C1006A3455 /* SDWebImageManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D8E148C56230056699D /* SDWebImageManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6DC1D06D2C1006A3455 /* UIButton+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D93148C56230056699D /* UIButton+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6DF1D06D2C1006A3455 /* FLAnimatedImageView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 43CE75CE1CFE98E0006C64D0 /* FLAnimatedImageView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6E11D06D2C1006A3455 /* SDWebImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A2CAE031AB4BB5400B6BC39 /* SDWebImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6E21D06D2C1006A3455 /* UIImageView+HighlightedWebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = ABBE71A518C43B4D00B75E91 /* UIImageView+HighlightedWebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6E31D06D2C1006A3455 /* SDImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D85148C56230056699D /* SDImageCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6E61D06D2C1006A3455 /* UIImageView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D95148C56230056699D /* UIImageView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6E71D06D2C1006A3455 /* SDWebImageCompat.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D88148C56230056699D /* SDWebImageCompat.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6E91D06D2C1006A3455 /* SDWebImageDownloaderOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 530E49E316460AE2002868E7 /* SDWebImageDownloaderOperation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6EB1D06D2C1006A3455 /* UIView+WebCacheOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = AB615301192DA24600A2D8E9 /* UIView+WebCacheOperation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6EE1D06D2C1006A3455 /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D5B9140188EE8DD006D06BD /* NSData+ImageContentType.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6EF1D06D2C1006A3455 /* SDWebImagePrefetcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D91148C56230056699D /* SDWebImagePrefetcher.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6F01D06D2C1006A3455 /* SDWebImageOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 530E49E71646388E002868E7 /* SDWebImageOperation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6F61D06D2C1006A3455 /* UIImage+MultiFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 53EDFB8817623F7C00698166 /* UIImage+MultiFormat.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6F91D06D2C1006A3455 /* UIImage+GIF.h in Headers */ = {isa = PBXBuildFile; fileRef = A18A6CC5172DC28500419892 /* UIImage+GIF.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6FA1D06D2C1006A3455 /* SDWebImageDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D8B148C56230056699D /* SDWebImageDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 431BB6FC1D06D2C1006A3455 /* SDWebImageDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D89148C56230056699D /* SDWebImageDecoder.h */; settings = {ATTRIBUTES = (Public, ); }; }; 438096721CDFC08200DC626B /* MKAnnotationView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 535699B415113E7300A4C397 /* MKAnnotationView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; 438096731CDFC08F00DC626B /* MKAnnotationView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 535699B515113E7300A4C397 /* MKAnnotationView+WebCache.m */; }; 438096741CDFC09C00DC626B /* UIImage+WebP.h in Headers */ = {isa = PBXBuildFile; fileRef = 53EDFB911762547C00698166 /* UIImage+WebP.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -359,6 +393,7 @@ /* Begin PBXFileReference section */ 00733A4C1BC487C000A5A117 /* SDWebImage.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDWebImage.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 431BB7031D06D2C1006A3455 /* SDWebImage.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDWebImage.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 43CE75491CFE9427006C64D0 /* FLAnimatedImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLAnimatedImage.h; sourceTree = ""; }; 43CE754A1CFE9427006C64D0 /* FLAnimatedImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLAnimatedImage.m; sourceTree = ""; }; 43CE754B1CFE9427006C64D0 /* FLAnimatedImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLAnimatedImageView.h; sourceTree = ""; }; @@ -491,6 +526,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 431BB6CA1D06D2C1006A3455 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 4A2CADFB1AB4BB5300B6BC39 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -574,6 +616,7 @@ 53761325155AD0D5005750A4 /* libSDWebImage.a */, 4A2CADFF1AB4BB5300B6BC39 /* SDWebImage.framework */, 00733A4C1BC487C000A5A117 /* SDWebImage.framework */, + 431BB7031D06D2C1006A3455 /* SDWebImage.framework */, ); name = Products; sourceTree = ""; @@ -848,6 +891,31 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 431BB6CB1D06D2C1006A3455 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 431BB6D71D06D2C1006A3455 /* UIImage+WebP.h in Headers */, + 431BB6D91D06D2C1006A3455 /* SDWebImageManager.h in Headers */, + 431BB6DC1D06D2C1006A3455 /* UIButton+WebCache.h in Headers */, + 431BB6DF1D06D2C1006A3455 /* FLAnimatedImageView+WebCache.h in Headers */, + 431BB6E11D06D2C1006A3455 /* SDWebImage.h in Headers */, + 431BB6E21D06D2C1006A3455 /* UIImageView+HighlightedWebCache.h in Headers */, + 431BB6E31D06D2C1006A3455 /* SDImageCache.h in Headers */, + 431BB6E61D06D2C1006A3455 /* UIImageView+WebCache.h in Headers */, + 431BB6E71D06D2C1006A3455 /* SDWebImageCompat.h in Headers */, + 431BB6E91D06D2C1006A3455 /* SDWebImageDownloaderOperation.h in Headers */, + 431BB6EB1D06D2C1006A3455 /* UIView+WebCacheOperation.h in Headers */, + 431BB6EE1D06D2C1006A3455 /* NSData+ImageContentType.h in Headers */, + 431BB6EF1D06D2C1006A3455 /* SDWebImagePrefetcher.h in Headers */, + 431BB6F01D06D2C1006A3455 /* SDWebImageOperation.h in Headers */, + 431BB6F61D06D2C1006A3455 /* UIImage+MultiFormat.h in Headers */, + 431BB6F91D06D2C1006A3455 /* UIImage+GIF.h in Headers */, + 431BB6FA1D06D2C1006A3455 /* SDWebImageDownloader.h in Headers */, + 431BB6FC1D06D2C1006A3455 /* SDWebImageDecoder.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 4A2CADFC1AB4BB5300B6BC39 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -986,6 +1054,24 @@ productReference = 00733A4C1BC487C000A5A117 /* SDWebImage.framework */; productType = "com.apple.product-type.framework"; }; + 431BB6891D06D2C1006A3455 /* SDWebImage watchOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 431BB7001D06D2C1006A3455 /* Build configuration list for PBXNativeTarget "SDWebImage watchOS" */; + buildPhases = ( + 431BB68A1D06D2C1006A3455 /* Sources */, + 431BB6CA1D06D2C1006A3455 /* Frameworks */, + 431BB6CB1D06D2C1006A3455 /* Headers */, + 431BB6FF1D06D2C1006A3455 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "SDWebImage watchOS"; + productName = "WebImage tvOS"; + productReference = 431BB7031D06D2C1006A3455 /* SDWebImage.framework */; + productType = "com.apple.product-type.framework"; + }; 4A2CADFE1AB4BB5300B6BC39 /* SDWebImage iOS */ = { isa = PBXNativeTarget; buildConfigurationList = 4A2CAE121AB4BB5400B6BC39 /* Build configuration list for PBXNativeTarget "SDWebImage iOS" */; @@ -1054,6 +1140,7 @@ 53761307155AD0D5005750A4 /* SDWebImage */, 4A2CADFE1AB4BB5300B6BC39 /* SDWebImage iOS */, 00733A4B1BC487C000A5A117 /* SDWebImage tvOS */, + 431BB6891D06D2C1006A3455 /* SDWebImage watchOS */, ); }; /* End PBXProject section */ @@ -1066,6 +1153,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 431BB6FF1D06D2C1006A3455 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 4A2CADFD1AB4BB5300B6BC39 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1163,6 +1257,29 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 431BB68A1D06D2C1006A3455 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 431BB68C1D06D2C1006A3455 /* SDWebImageDownloaderOperation.m in Sources */, + 431BB68E1D06D2C1006A3455 /* SDWebImagePrefetcher.m in Sources */, + 431BB6901D06D2C1006A3455 /* FLAnimatedImageView+WebCache.m in Sources */, + 431BB6921D06D2C1006A3455 /* NSData+ImageContentType.m in Sources */, + 431BB69A1D06D2C1006A3455 /* SDWebImageDownloader.m in Sources */, + 431BB6A31D06D2C1006A3455 /* UIImageView+WebCache.m in Sources */, + 431BB6AA1D06D2C1006A3455 /* SDWebImageManager.m in Sources */, + 431BB6AC1D06D2C1006A3455 /* SDWebImageCompat.m in Sources */, + 431BB6B11D06D2C1006A3455 /* UIView+WebCacheOperation.m in Sources */, + 431BB6B41D06D2C1006A3455 /* SDWebImageDecoder.m in Sources */, + 431BB6B61D06D2C1006A3455 /* UIImage+WebP.m in Sources */, + 431BB6B91D06D2C1006A3455 /* UIButton+WebCache.m in Sources */, + 431BB6BD1D06D2C1006A3455 /* UIImage+GIF.m in Sources */, + 431BB6C01D06D2C1006A3455 /* SDImageCache.m in Sources */, + 431BB6C41D06D2C1006A3455 /* UIImage+MultiFormat.m in Sources */, + 431BB6C71D06D2C1006A3455 /* UIImageView+HighlightedWebCache.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 4A2CADFA1AB4BB5300B6BC39 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1321,7 +1438,6 @@ ENABLE_TESTABILITY = YES; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = WebImage/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.dailymotion.$(PRODUCT_NAME:rfc1034identifier).tvos"; @@ -1350,7 +1466,6 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = WebImage/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.dailymotion.$(PRODUCT_NAME:rfc1034identifier).tvos"; @@ -1364,6 +1479,62 @@ }; name = Release; }; + 431BB7011D06D2C1006A3455 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = WebImage/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.dailymotion.$(PRODUCT_NAME:rfc1034identifier).watchos"; + PRODUCT_NAME = SDWebImage; + SDKROOT = watchos; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "watchsimulator watchos"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = 3; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Debug; + }; + 431BB7021D06D2C1006A3455 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = WebImage/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "com.dailymotion.$(PRODUCT_NAME:rfc1034identifier).watchos"; + PRODUCT_NAME = SDWebImage; + SDKROOT = watchos; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "watchsimulator watchos"; + TARGETED_DEVICE_FAMILY = 3; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Release; + }; 4A2CAE131AB4BB5400B6BC39 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1450,7 +1621,6 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", - "SD_WEBP=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; @@ -1506,10 +1676,7 @@ ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "SD_WEBP=1", - "$(inherited)", - ); + GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; @@ -1548,6 +1715,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 431BB7001D06D2C1006A3455 /* Build configuration list for PBXNativeTarget "SDWebImage watchOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 431BB7011D06D2C1006A3455 /* Debug */, + 431BB7021D06D2C1006A3455 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 4A2CAE121AB4BB5400B6BC39 /* Build configuration list for PBXNativeTarget "SDWebImage iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/SDWebImage.xcodeproj/xcshareddata/xcschemes/SDWebImage watchOS.xcscheme b/SDWebImage.xcodeproj/xcshareddata/xcschemes/SDWebImage watchOS.xcscheme new file mode 100644 index 0000000..70ec405 --- /dev/null +++ b/SDWebImage.xcodeproj/xcshareddata/xcschemes/SDWebImage watchOS.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SDWebImage.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/SDWebImage.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..08de0be --- /dev/null +++ b/SDWebImage.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded + + + diff --git a/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.h b/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.h index acd4a8a..e7610a3 100644 --- a/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.h +++ b/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.h @@ -6,6 +6,7 @@ * file that was distributed with this source code. */ +#if TARGET_OS_IOS || TARGET_OS_TV #if COCOAPODS @import FLAnimatedImage; @@ -139,3 +140,5 @@ - (void)sd_cancelCurrentImageLoad; @end + +#endif diff --git a/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.m b/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.m index 145ef5f..eca0420 100644 --- a/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.m +++ b/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.m @@ -6,6 +6,7 @@ * file that was distributed with this source code. */ +#if TARGET_OS_IOS || TARGET_OS_TV #import "FLAnimatedImageView+WebCache.h" #import "objc/runtime.h" @@ -117,3 +118,5 @@ static char imageURLKey; @end + +#endif diff --git a/SDWebImage/SDImageCache.m b/SDWebImage/SDImageCache.m index f49e381..4727a3d 100644 --- a/SDWebImage/SDImageCache.m +++ b/SDWebImage/SDImageCache.m @@ -21,14 +21,17 @@ - (nonnull instancetype)init { self = [super init]; if (self) { +#if TARGET_OS_IOS || TARGET_OS_TV [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(removeAllObjects) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif } return self; } - (void)dealloc { +#if TARGET_OS_IOS || TARGET_OS_TV [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; - +#endif } @end @@ -126,7 +129,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { _fileManager = [NSFileManager new]; }); -#if TARGET_OS_IOS +#if TARGET_OS_IOS || TARGET_OS_TV // Subscribe to app events [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clearMemory) @@ -211,7 +214,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { NSData *data = imageData; if (image && (recalculate || !data)) { -#if TARGET_OS_IPHONE +#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH // We need to determine if the image is a PNG or a JPEG // PNGs are easier to detect because they have a unique signature (http://www.w3.org/TR/PNG-Structure.html) // The first eight bytes of a PNG file always contain the following (decimal) values: @@ -589,6 +592,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { }); } +#if TARGET_OS_IOS || TARGET_OS_TV - (void)backgroundCleanDisk { Class UIApplicationClass = NSClassFromString(@"UIApplication"); if(!UIApplicationClass || ![UIApplicationClass respondsToSelector:@selector(sharedApplication)]) { @@ -608,6 +612,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { bgTask = UIBackgroundTaskInvalid; }]; } +#endif - (NSUInteger)getSize { __block NSUInteger size = 0; diff --git a/SDWebImage/SDWebImageCompat.h b/SDWebImage/SDWebImageCompat.h index 3c21b41..3d4b48d 100644 --- a/SDWebImage/SDWebImageCompat.h +++ b/SDWebImage/SDWebImageCompat.h @@ -18,17 +18,18 @@ #endif #if !TARGET_OS_IPHONE -#import -#ifndef UIImage -#define UIImage NSImage -#endif -#ifndef UIImageView -#define UIImageView NSImageView -#endif + #import + #ifndef UIImage + #define UIImage NSImage + #endif + #ifndef UIImageView + #define UIImageView NSImageView + #endif #else - -#import - + #import + #if TARGET_OS_WATCH + #import + #endif #endif #ifndef NS_ENUM diff --git a/SDWebImage/SDWebImageCompat.m b/SDWebImage/SDWebImageCompat.m index 77a8c50..1380f3d 100644 --- a/SDWebImage/SDWebImageCompat.m +++ b/SDWebImage/SDWebImageCompat.m @@ -27,7 +27,11 @@ inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullabl return [UIImage animatedImageWithImages:scaledImages duration:image.duration]; } else { +#if TARGET_OS_WATCH + if ([[WKInterfaceDevice currentDevice] respondsToSelector:@selector(screenScale)]) { +#else if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { +#endif CGFloat scale = 1; if (key.length >= 8) { NSRange range = [key rangeOfString:@"@2x."]; diff --git a/SDWebImage/SDWebImageDownloaderOperation.m b/SDWebImage/SDWebImageDownloaderOperation.m index 5baa83a..766e683 100644 --- a/SDWebImage/SDWebImageDownloaderOperation.m +++ b/SDWebImage/SDWebImageDownloaderOperation.m @@ -41,7 +41,7 @@ typedef NSMutableDictionary SDCallbacksDictionary; @property (strong, atomic, nullable) NSThread *thread; @property (SDDispatchQueueSetterSementics, nonatomic, nullable) dispatch_queue_t barrierQueue; -#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0 +#if TARGET_OS_IOS || TARGET_OS_TV @property (assign, nonatomic) UIBackgroundTaskIdentifier backgroundTaskId; #endif @@ -125,7 +125,7 @@ typedef NSMutableDictionary SDCallbacksDictionary; return; } -#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0 +#if TARGET_OS_IOS || TARGET_OS_TV Class UIApplicationClass = NSClassFromString(@"UIApplication"); BOOL hasApplication = UIApplicationClass && [UIApplicationClass respondsToSelector:@selector(sharedApplication)]; if (hasApplication && [self shouldContinueWhenAppEntersBackground]) { @@ -179,7 +179,7 @@ typedef NSMutableDictionary SDCallbacksDictionary; } } -#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0 +#if TARGET_OS_IOS || TARGET_OS_TV Class UIApplicationClass = NSClassFromString(@"UIApplication"); if(!UIApplicationClass || ![UIApplicationClass respondsToSelector:@selector(sharedApplication)]) { return; @@ -345,7 +345,7 @@ didReceiveResponse:(NSURLResponse *)response // Create the image CGImageRef partialImageRef = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL); -#ifdef TARGET_OS_IPHONE +#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH // Workaround for iOS anamorphic image if (partialImageRef) { const size_t partialHeight = CGImageGetHeight(partialImageRef); diff --git a/SDWebImage/UIButton+WebCache.h b/SDWebImage/UIButton+WebCache.h index 122c29d..e011501 100644 --- a/SDWebImage/UIButton+WebCache.h +++ b/SDWebImage/UIButton+WebCache.h @@ -9,6 +9,8 @@ #import "SDWebImageCompat.h" #import "SDWebImageManager.h" +#if TARGET_OS_IOS || TARGET_OS_TV + /** * Integrates SDWebImage async downloading and caching of remote images with UIButtonView. */ @@ -230,3 +232,5 @@ - (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state; @end + +#endif diff --git a/SDWebImage/UIButton+WebCache.m b/SDWebImage/UIButton+WebCache.m index 84b9c5d..5ffaa57 100644 --- a/SDWebImage/UIButton+WebCache.m +++ b/SDWebImage/UIButton+WebCache.m @@ -10,6 +10,8 @@ #import "objc/runtime.h" #import "UIView+WebCacheOperation.h" +#if TARGET_OS_IOS || TARGET_OS_TV + static char imageURLStorageKey; typedef NSMutableDictionary SDStateImageURLDictionary; @@ -183,3 +185,5 @@ typedef NSMutableDictionary SDStateImageURLDictionary; } @end + +#endif diff --git a/SDWebImage/UIImage+GIF.h b/SDWebImage/UIImage+GIF.h index 63cb856..a177969 100755 --- a/SDWebImage/UIImage+GIF.h +++ b/SDWebImage/UIImage+GIF.h @@ -8,6 +8,9 @@ */ #import +#if TARGET_OS_WATCH + #import +#endif @interface UIImage (GIF) diff --git a/SDWebImage/UIImage+GIF.m b/SDWebImage/UIImage+GIF.m index 37c5130..e8bcca0 100755 --- a/SDWebImage/UIImage+GIF.m +++ b/SDWebImage/UIImage+GIF.m @@ -29,8 +29,16 @@ } else { // we will only retrieve the 1st frame. the full GIF support is available via the FLAnimatedImageView category. // this here is only code to allow drawing animated images as static ones + CGFloat scale = 1; +#if TARGET_OS_WATCH + scale = [WKInterfaceDevice currentDevice].screenScale; +#else + scale = [UIScreen mainScreen].scale; +#endif + + CGImageRef CGImage = CGImageSourceCreateImageAtIndex(source, 0, NULL); - UIImage *frameImage = [UIImage imageWithCGImage:CGImage scale:[UIScreen mainScreen].scale orientation:UIImageOrientationUp]; + UIImage *frameImage = [UIImage imageWithCGImage:CGImage scale:scale orientation:UIImageOrientationUp]; staticImage = [UIImage animatedImageWithImages:@[frameImage] duration:0.0f]; CGImageRelease(CGImage); } diff --git a/SDWebImage/UIImageView+HighlightedWebCache.h b/SDWebImage/UIImageView+HighlightedWebCache.h index d97b4f0..1605b97 100644 --- a/SDWebImage/UIImageView+HighlightedWebCache.h +++ b/SDWebImage/UIImageView+HighlightedWebCache.h @@ -10,6 +10,8 @@ #import "SDWebImageCompat.h" #import "SDWebImageManager.h" +#if TARGET_OS_IOS || TARGET_OS_TV + /** * Integrates SDWebImage async downloading and caching of remote images with UIImageView for highlighted state. */ @@ -92,3 +94,5 @@ - (void)sd_cancelCurrentHighlightedImageLoad; @end + +#endif diff --git a/SDWebImage/UIImageView+HighlightedWebCache.m b/SDWebImage/UIImageView+HighlightedWebCache.m index dbc3374..fe581b8 100644 --- a/SDWebImage/UIImageView+HighlightedWebCache.m +++ b/SDWebImage/UIImageView+HighlightedWebCache.m @@ -9,6 +9,8 @@ #import "UIImageView+HighlightedWebCache.h" #import "UIView+WebCacheOperation.h" +#if TARGET_OS_IOS || TARGET_OS_TV + #define UIImageViewHighlightedWebCacheOperationKey @"highlightedImage" @implementation UIImageView (HighlightedWebCache) @@ -71,3 +73,5 @@ } @end + +#endif diff --git a/SDWebImage/UIImageView+WebCache.h b/SDWebImage/UIImageView+WebCache.h index 85ca2ed..a41102b 100644 --- a/SDWebImage/UIImageView+WebCache.h +++ b/SDWebImage/UIImageView+WebCache.h @@ -9,6 +9,8 @@ #import "SDWebImageCompat.h" #import "SDWebImageManager.h" +#if TARGET_OS_IOS || TARGET_OS_TV + /** * Integrates SDWebImage async downloading and caching of remote images with UIImageView. * @@ -211,3 +213,5 @@ @end + +#endif diff --git a/SDWebImage/UIImageView+WebCache.m b/SDWebImage/UIImageView+WebCache.m index a928660..5f2bca5 100644 --- a/SDWebImage/UIImageView+WebCache.m +++ b/SDWebImage/UIImageView+WebCache.m @@ -10,6 +10,8 @@ #import "objc/runtime.h" #import "UIView+WebCacheOperation.h" +#if TARGET_OS_IOS || TARGET_OS_TV + static char imageURLKey; static char TAG_ACTIVITY_INDICATOR; static char TAG_ACTIVITY_STYLE; @@ -218,3 +220,5 @@ static char TAG_ACTIVITY_SHOW; } @end + +#endif diff --git a/SDWebImage/UIView+WebCacheOperation.h b/SDWebImage/UIView+WebCacheOperation.h index 8f83eda..1c6fa23 100644 --- a/SDWebImage/UIView+WebCacheOperation.h +++ b/SDWebImage/UIView+WebCacheOperation.h @@ -9,6 +9,8 @@ #import #import "SDWebImageManager.h" +#if TARGET_OS_IOS || TARGET_OS_TV + @interface UIView (WebCacheOperation) /** @@ -34,3 +36,5 @@ - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key; @end + +#endif diff --git a/SDWebImage/UIView+WebCacheOperation.m b/SDWebImage/UIView+WebCacheOperation.m index 2533930..dd607f9 100644 --- a/SDWebImage/UIView+WebCacheOperation.m +++ b/SDWebImage/UIView+WebCacheOperation.m @@ -9,6 +9,8 @@ #import "UIView+WebCacheOperation.h" #import "objc/runtime.h" +#if TARGET_OS_IOS || TARGET_OS_TV + static char loadOperationKey; typedef NSMutableDictionary SDOperationsDictionary; @@ -59,3 +61,5 @@ typedef NSMutableDictionary SDOperationsDictionary; } @end + +#endif