PINRemoteImageMacros.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // PINRemoteImageMacros.h
  3. // PINRemoteImage
  4. //
  5. #import <TargetConditionals.h>
  6. #ifndef PINRemoteImageMacros_h
  7. #define PINRemoteImageMacros_h
  8. #define PIN_TARGET_IOS (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR || TARGET_OS_TV)
  9. #define PIN_TARGET_MAC (TARGET_OS_MAC)
  10. #define PINRemoteImageLogging 0
  11. #if PINRemoteImageLogging
  12. #define PINLog(args...) NSLog(args)
  13. #else
  14. #define PINLog(args...)
  15. #endif
  16. #if __has_include(<FLAnimatedImage/FLAnimatedImage.h>)
  17. #define USE_FLANIMATED_IMAGE 1
  18. #else
  19. #define USE_FLANIMATED_IMAGE 0
  20. #define FLAnimatedImage NSObject
  21. #endif
  22. #if __has_include(<PINCache/PINCache.h>)
  23. #define USE_PINCACHE 1
  24. #else
  25. #define USE_PINCACHE 0
  26. #endif
  27. #if PIN_TARGET_IOS
  28. #define PINImage UIImage
  29. #define PINImageView UIImageView
  30. #define PINButton UIButton
  31. #elif PIN_TARGET_MAC
  32. #define PINImage NSImage
  33. #define PINImageView NSImageView
  34. #define PINButton NSButton
  35. #endif
  36. #define BlockAssert(condition, desc, ...) \
  37. do { \
  38. __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \
  39. if (!(condition)) { \
  40. [[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \
  41. object:strongSelf file:[NSString stringWithUTF8String:__FILE__] \
  42. lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \
  43. } \
  44. __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \
  45. } while(0);
  46. #endif /* PINRemoteImageMacros_h */