-
-
Save wenghengcong/7a8a2ada2d1c739e9eafbd65c919f453 to your computer and use it in GitHub Desktop.
SDWebImage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import <TargetConditionals.h> | |
| #ifdef __OBJC_GC__ | |
| #error SDWebImage does not support Objective-C Garbage Collection | |
| #endif | |
| // Seems like TARGET_OS_MAC is always defined (on all platforms). | |
| // To determine if we are running on macOS, use TARGET_OS_OSX in Xcode 8 | |
| #if TARGET_OS_OSX | |
| #define SD_MAC 1 | |
| #else | |
| #define SD_MAC 0 | |
| #endif | |
| // iOS and tvOS are very similar, UIKit exists on both platforms | |
| // Note: watchOS also has UIKit, but it's very limited | |
| #if TARGET_OS_IOS || TARGET_OS_TV | |
| #define SD_UIKIT 1 | |
| #else | |
| #define SD_UIKIT 0 | |
| #endif | |
| #if TARGET_OS_IOS | |
| #define SD_IOS 1 | |
| #else | |
| #define SD_IOS 0 | |
| #endif | |
| #if TARGET_OS_TV | |
| #define SD_TV 1 | |
| #else | |
| #define SD_TV 0 | |
| #endif | |
| #if TARGET_OS_WATCH | |
| #define SD_WATCH 1 | |
| #else | |
| #define SD_WATCH 0 | |
| #endif | |
| #if SD_MAC | |
| #import <AppKit/AppKit.h> | |
| #ifndef UIImage | |
| #define UIImage NSImage | |
| #endif | |
| #ifndef UIImageView | |
| #define UIImageView NSImageView | |
| #endif | |
| #ifndef UIView | |
| #define UIView NSView | |
| #endif | |
| #ifndef UIColor | |
| #define UIColor NSColor | |
| #endif | |
| #else | |
| #if SD_UIKIT | |
| #import <UIKit/UIKit.h> | |
| #endif | |
| #if SD_WATCH | |
| #import <WatchKit/WatchKit.h> | |
| #ifndef UIView | |
| #define UIView WKInterfaceObject | |
| #endif | |
| #ifndef UIImageView | |
| #define UIImageView WKInterfaceImage | |
| #endif | |
| #endif | |
| #endif | |
| #ifndef NS_ENUM | |
| #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type | |
| #endif | |
| #ifndef NS_OPTIONS | |
| #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type | |
| #endif | |
| #ifndef dispatch_main_async_safe | |
| #define dispatch_main_async_safe(block)\ | |
| if (dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(dispatch_get_main_queue())) {\ | |
| block();\ | |
| } else {\ | |
| dispatch_async(dispatch_get_main_queue(), block);\ | |
| } | |
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 64位整型 | |
| const int64_t SDWebImageProgressUnitCountUnknown = 1LL; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment