SVGKDefine.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. SVGKDefine.h
  3. SVGKDefine define some common macro used for public header or private header.
  4. Currently here are some platform define to allow us to simply write code cross Apple's platforms.
  5. */
  6. #ifndef SVGKDefine_h
  7. #define SVGKDefine_h
  8. #include "TargetConditionals.h"
  9. // Apple's defines from TargetConditionals.h are a bit weird.
  10. // Seems like TARGET_OS_MAC is always defined (on all platforms).
  11. // To determine if we are running on OSX, we can only rely on TARGET_OS_IPHONE=0 and all the other platforms
  12. #if !TARGET_OS_IPHONE && !TARGET_OS_IOS && !TARGET_OS_TV && !TARGET_OS_WATCH
  13. #define SVGKIT_MAC 1
  14. #else
  15. #define SVGKIT_MAC 0
  16. #endif
  17. // iOS and tvOS are very similar, UIKit exists on both platforms
  18. // Note: watchOS also has UIKit, but it's very limited
  19. #if TARGET_OS_IOS || TARGET_OS_TV
  20. #define SVGKIT_UIKIT 1
  21. #else
  22. #define SVGKIT_UIKIT 0
  23. #endif
  24. #if TARGET_OS_IOS
  25. #define SVGKIT_IOS 1
  26. #else
  27. #define SVGKIT_IOS 0
  28. #endif
  29. #if TARGET_OS_TV
  30. #define SVGKIT_TV 1
  31. #else
  32. #define SVGKIT_TV 0
  33. #endif
  34. #if TARGET_OS_WATCH
  35. #define SVGKIT_WATCH 1
  36. #else
  37. #define SVGKIT_WATCH 0
  38. #endif
  39. #if SVGKIT_MAC
  40. #ifndef UIImage
  41. #define UIImage NSImage
  42. #endif
  43. #ifndef UIImageView
  44. #define UIImageView NSImageView
  45. #endif
  46. #ifndef UIView
  47. #define UIView NSView
  48. #endif
  49. #ifndef UIColor
  50. #define UIColor NSColor
  51. #endif
  52. #ifndef UIFont
  53. #define UIFont NSFont
  54. #endif
  55. #endif
  56. #if SVGKIT_MAC
  57. #import <AppKit/AppKit.h>
  58. #else
  59. #import <UIKit/UIKit.h>
  60. #endif
  61. #endif /* SVGKDefine_h */