Guest User

Untitled

a guest
Jul 22nd, 2019
74
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import <TargetConditionals.h>
  2.  
  3. #ifdef __OBJC_GC__
  4. #error SDWebImage does not support Objective-C Garbage Collection
  5. #endif
  6.  
  7. // Seems like TARGET_OS_MAC is always defined (on all platforms).
  8. // To determine if we are running on macOS, use TARGET_OS_OSX in Xcode 8
  9. #if TARGET_OS_OSX
  10. #define SD_MAC 1
  11. #else
  12. #define SD_MAC 0
  13. #endif
  14.  
  15. // iOS and tvOS are very similar, UIKit exists on both platforms
  16. // Note: watchOS also has UIKit, but it's very limited
  17. #if TARGET_OS_IOS || TARGET_OS_TV
  18. #define SD_UIKIT 1
  19. #else
  20. #define SD_UIKIT 0
  21. #endif
  22.  
  23. #if TARGET_OS_IOS
  24. #define SD_IOS 1
  25. #else
  26. #define SD_IOS 0
  27. #endif
  28.  
  29. #if TARGET_OS_TV
  30. #define SD_TV 1
  31. #else
  32. #define SD_TV 0
  33. #endif
  34.  
  35. #if TARGET_OS_WATCH
  36. #define SD_WATCH 1
  37. #else
  38. #define SD_WATCH 0
  39. #endif
  40.  
  41.  
  42. #if SD_MAC
  43. #import <AppKit/AppKit.h>
  44. #ifndef UIImage
  45. #define UIImage NSImage
  46. #endif
  47. #ifndef UIImageView
  48. #define UIImageView NSImageView
  49. #endif
  50. #ifndef UIView
  51. #define UIView NSView
  52. #endif
  53. #ifndef UIColor
  54. #define UIColor NSColor
  55. #endif
  56. #else
  57. #if SD_UIKIT
  58. #import <UIKit/UIKit.h>
  59. #endif
  60. #if SD_WATCH
  61. #import <WatchKit/WatchKit.h>
  62. #ifndef UIView
  63. #define UIView WKInterfaceObject
  64. #endif
  65. #ifndef UIImageView
  66. #define UIImageView WKInterfaceImage
  67. #endif
  68. #endif
  69. #endif
  70.  
  71. #ifndef NS_ENUM
  72. #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
  73. #endif
  74.  
  75. #ifndef NS_OPTIONS
  76. #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
  77. #endif
  78.  
  79. #ifndef dispatch_main_async_safe
  80. #define dispatch_main_async_safe(block)\
  81. if (dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(dispatch_get_main_queue())) {\
  82. block();\
  83. } else {\
  84. dispatch_async(dispatch_get_main_queue(), block);\
  85. }
  86. #endif
RAW Paste Data