@octane-xplat/nativescript-mason-core 0.0.1 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +198 -2
- package/artifact-inventory.json +774 -0
- package/box-shadow.d.ts +10 -0
- package/box-shadow.js +48 -0
- package/common.d.ts +485 -0
- package/common.js +2659 -0
- package/css-colors.d.ts +17 -0
- package/css-colors.js +54 -0
- package/css-environment.d.ts +49 -0
- package/css-environment.js +309 -0
- package/css-filter.d.ts +17 -0
- package/css-filter.js +140 -0
- package/css-keyframes.d.ts +41 -0
- package/css-keyframes.js +437 -0
- package/css-math.d.ts +34 -0
- package/css-math.js +300 -0
- package/css-shorthands.d.ts +65 -0
- package/css-shorthands.js +673 -0
- package/css-transform.d.ts +6 -0
- package/css-transform.js +100 -0
- package/diagnostics.d.ts +51 -0
- package/diagnostics.js +52 -0
- package/display-density.d.ts +9 -0
- package/display-density.js +20 -0
- package/fonts.d.ts +20 -0
- package/fonts.js +88 -0
- package/foreign-layout.d.ts +6 -0
- package/foreign-layout.js +151 -0
- package/gradient-stops.d.ts +25 -0
- package/gradient-stops.js +112 -0
- package/index.android.d.ts +11 -0
- package/index.android.js +9 -0
- package/index.d.ts +12 -0
- package/index.ios.d.ts +11 -0
- package/index.ios.js +9 -0
- package/ios-host-README.md +124 -0
- package/layout-types.d.ts +192 -0
- package/mask.d.ts +54 -0
- package/mask.js +26 -0
- package/native-environment.android.d.ts +3 -0
- package/native-environment.android.js +69 -0
- package/native-environment.d.ts +3 -0
- package/native-environment.ios.d.ts +3 -0
- package/native-environment.ios.js +65 -0
- package/native-types-README.md +51 -0
- package/package.json +47 -6
- package/panel-helpers.d.ts +3 -0
- package/panel-helpers.js +8 -0
- package/platforms/android/MasonCore.aar +0 -0
- package/platforms/android/include.gradle +6 -0
- package/platforms/android/manifest.json +73 -0
- package/platforms/ios/FontManager.LICENSE +201 -0
- package/platforms/ios/MasonCore.xcframework/Info.plist +43 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/Mason.h +25 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/MasonCore-Swift.h +1739 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/mason_native.h +601 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Info.plist +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/MasonCore +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.abi.json +100095 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.private.swiftinterface +3174 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.swiftinterface +3174 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/module.modulemap +9 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/SDWebImage_SDWebImage.bundle/Info.plist +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/SDWebImage_SDWebImage.bundle/PrivacyInfo.xcprivacy +23 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/Mason.h +25 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/MasonCore-Swift.h +1739 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/mason_native.h +601 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Info.plist +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/MasonCore +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.abi.json +100095 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3174 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3174 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/module.modulemap +9 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/SDWebImage_SDWebImage.bundle/Info.plist +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/SDWebImage_SDWebImage.bundle/PrivacyInfo.xcprivacy +23 -0
- package/platforms/ios/Package.resolved +24 -0
- package/platforms/ios/SDWebImage.LICENSE +20 -0
- package/platforms/ios/build.xcconfig +4 -0
- package/platforms/ios/device-manifest.json +213 -0
- package/platforms/ios/include/FontManager/NSCFontDescriptors.h +36 -0
- package/platforms/ios/include/FontManager/NSCFontFace.h +98 -0
- package/platforms/ios/include/FontManager/NSCFontFaceSet.h +73 -0
- package/platforms/ios/include/FontManager/NSCFontManagerUmbrella.h +7 -0
- package/platforms/ios/include/FontManager/NSCFontParser.h +22 -0
- package/platforms/ios/include/FontManager/NSCFontRegex.h +4 -0
- package/platforms/ios/include/FontManager/NSCFontResolver.h +43 -0
- package/platforms/ios/include/FontManager/NSCFontStyle.h +27 -0
- package/platforms/ios/include/FontManager/NSCFontTypes.h +41 -0
- package/platforms/ios/include/SDWebImage/NSButton+WebCache.h +340 -0
- package/platforms/ios/include/SDWebImage/NSData+ImageContentType.h +63 -0
- package/platforms/ios/include/SDWebImage/NSImage+Compatibility.h +67 -0
- package/platforms/ios/include/SDWebImage/SDAnimatedImage.h +136 -0
- package/platforms/ios/include/SDWebImage/SDAnimatedImagePlayer.h +113 -0
- package/platforms/ios/include/SDWebImage/SDAnimatedImageRep.h +33 -0
- package/platforms/ios/include/SDWebImage/SDAnimatedImageView+WebCache.h +168 -0
- package/platforms/ios/include/SDWebImage/SDAnimatedImageView.h +125 -0
- package/platforms/ios/include/SDWebImage/SDCallbackQueue.h +59 -0
- package/platforms/ios/include/SDWebImage/SDDiskCache.h +146 -0
- package/platforms/ios/include/SDWebImage/SDGraphicsImageRenderer.h +84 -0
- package/platforms/ios/include/SDWebImage/SDImageAPNGCoder.h +19 -0
- package/platforms/ios/include/SDWebImage/SDImageAWebPCoder.h +23 -0
- package/platforms/ios/include/SDWebImage/SDImageCache.h +482 -0
- package/platforms/ios/include/SDWebImage/SDImageCacheConfig.h +153 -0
- package/platforms/ios/include/SDWebImage/SDImageCacheDefine.h +179 -0
- package/platforms/ios/include/SDWebImage/SDImageCachesManager.h +81 -0
- package/platforms/ios/include/SDWebImage/SDImageCoder.h +347 -0
- package/platforms/ios/include/SDWebImage/SDImageCoderHelper.h +251 -0
- package/platforms/ios/include/SDWebImage/SDImageCodersManager.h +58 -0
- package/platforms/ios/include/SDWebImage/SDImageFrame.h +44 -0
- package/platforms/ios/include/SDWebImage/SDImageGIFCoder.h +22 -0
- package/platforms/ios/include/SDWebImage/SDImageGraphics.h +28 -0
- package/platforms/ios/include/SDWebImage/SDImageHEICCoder.h +25 -0
- package/platforms/ios/include/SDWebImage/SDImageIOAnimatedCoder.h +65 -0
- package/platforms/ios/include/SDWebImage/SDImageIOCoder.h +30 -0
- package/platforms/ios/include/SDWebImage/SDImageLoader.h +146 -0
- package/platforms/ios/include/SDWebImage/SDImageLoadersManager.h +40 -0
- package/platforms/ios/include/SDWebImage/SDImageTransformer.h +283 -0
- package/platforms/ios/include/SDWebImage/SDMemoryCache.h +78 -0
- package/platforms/ios/include/SDWebImage/SDWebImage.h +91 -0
- package/platforms/ios/include/SDWebImage/SDWebImageCacheKeyFilter.h +35 -0
- package/platforms/ios/include/SDWebImage/SDWebImageCacheSerializer.h +39 -0
- package/platforms/ios/include/SDWebImage/SDWebImageCompat.h +102 -0
- package/platforms/ios/include/SDWebImage/SDWebImageDefine.h +420 -0
- package/platforms/ios/include/SDWebImage/SDWebImageDownloader.h +320 -0
- package/platforms/ios/include/SDWebImage/SDWebImageDownloaderConfig.h +113 -0
- package/platforms/ios/include/SDWebImage/SDWebImageDownloaderDecryptor.h +52 -0
- package/platforms/ios/include/SDWebImage/SDWebImageDownloaderOperation.h +191 -0
- package/platforms/ios/include/SDWebImage/SDWebImageDownloaderRequestModifier.h +72 -0
- package/platforms/ios/include/SDWebImage/SDWebImageDownloaderResponseModifier.h +72 -0
- package/platforms/ios/include/SDWebImage/SDWebImageError.h +33 -0
- package/platforms/ios/include/SDWebImage/SDWebImageIndicator.h +119 -0
- package/platforms/ios/include/SDWebImage/SDWebImageManager.h +290 -0
- package/platforms/ios/include/SDWebImage/SDWebImageOperation.h +27 -0
- package/platforms/ios/include/SDWebImage/SDWebImageOptionsProcessor.h +78 -0
- package/platforms/ios/include/SDWebImage/SDWebImagePrefetcher.h +168 -0
- package/platforms/ios/include/SDWebImage/SDWebImageTransition.h +131 -0
- package/platforms/ios/include/SDWebImage/UIButton+WebCache.h +402 -0
- package/platforms/ios/include/SDWebImage/UIImage+ExtendedCacheData.h +24 -0
- package/platforms/ios/include/SDWebImage/UIImage+ForceDecode.h +52 -0
- package/platforms/ios/include/SDWebImage/UIImage+GIF.h +26 -0
- package/platforms/ios/include/SDWebImage/UIImage+MemoryCacheCost.h +27 -0
- package/platforms/ios/include/SDWebImage/UIImage+Metadata.h +104 -0
- package/platforms/ios/include/SDWebImage/UIImage+MultiFormat.h +81 -0
- package/platforms/ios/include/SDWebImage/UIImage+Transform.h +164 -0
- package/platforms/ios/include/SDWebImage/UIImageView+HighlightedWebCache.h +142 -0
- package/platforms/ios/include/SDWebImage/UIImageView+WebCache.h +209 -0
- package/platforms/ios/include/SDWebImage/UIView+WebCache.h +131 -0
- package/platforms/ios/include/SDWebImage/UIView+WebCacheOperation.h +52 -0
- package/platforms/ios/include/SDWebImage/UIView+WebCacheState.h +63 -0
- package/platforms/ios/include/module.modulemap +2 -0
- package/platforms/ios/manifest.json +132 -0
- package/platforms/ios/simulator-manifest.json +213 -0
- package/plugin-README.md +234 -0
- package/properties.d.ts +154 -0
- package/properties.js +2456 -0
- package/pseudo.d.ts +9 -0
- package/pseudo.js +57 -0
- package/scroll/index.android.d.ts +15 -0
- package/scroll/index.android.js +72 -0
- package/scroll/index.d.ts +5 -0
- package/scroll/index.ios.d.ts +18 -0
- package/scroll/index.ios.js +106 -0
- package/style.d.ts +768 -0
- package/style.js +7167 -0
- package/symbols.d.ts +25 -0
- package/symbols.js +41 -0
- package/tree/index.android.d.ts +11 -0
- package/tree/index.android.js +42 -0
- package/tree/index.d.ts +15 -0
- package/tree/index.ios.d.ts +26 -0
- package/tree/index.ios.js +53 -0
- package/typings/android-declarations.d.ts +4 -0
- package/typings/android.d.ts +9730 -0
- package/typings/manifest.json +45 -0
- package/typings/native.d.ts +5 -0
- package/typings/objc!FontManager.d.ts +389 -0
- package/typings/objc!MasonCore.d.ts +2472 -0
- package/typings/objc!SDWebImage.d.ts +3378 -0
- package/units.d.ts +29 -0
- package/units.js +44 -0
- package/utils/index.android.d.ts +211 -0
- package/utils/index.android.js +595 -0
- package/utils/index.ios.d.ts +222 -0
- package/utils/index.ios.js +790 -0
- package/view/index.android.d.ts +13 -0
- package/view/index.android.js +74 -0
- package/view/index.d.ts +2 -0
- package/view/index.ios.d.ts +24 -0
- package/view/index.ios.js +157 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the SDWebImage package.
|
|
3
|
+
* (c) Olivier Poitrey <rs@dailymotion.com>
|
|
4
|
+
*
|
|
5
|
+
* For the full copyright and license information, please view the LICENSE
|
|
6
|
+
* file that was distributed with this source code.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#import "SDWebImageCompat.h"
|
|
10
|
+
#import "UIImage+Transform.h"
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
Return the transformed cache key which applied with specify transformerKey.
|
|
14
|
+
|
|
15
|
+
@param key The original cache key
|
|
16
|
+
@param transformerKey The transformer key from the transformer
|
|
17
|
+
@return The transformed cache key
|
|
18
|
+
*/
|
|
19
|
+
FOUNDATION_EXPORT NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString * _Nonnull transformerKey);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
Return the thumbnailed cache key which applied with specify thumbnailSize and preserveAspectRatio control.
|
|
23
|
+
@param key The original cache key
|
|
24
|
+
@param thumbnailPixelSize The thumbnail pixel size
|
|
25
|
+
@param preserveAspectRatio The preserve aspect ratio option
|
|
26
|
+
@return The thumbnailed cache key
|
|
27
|
+
@note If you have both transformer and thumbnail applied for image, call `SDThumbnailedKeyForKey` firstly and then with `SDTransformedKeyForKey`.`
|
|
28
|
+
*/
|
|
29
|
+
FOUNDATION_EXPORT NSString * _Nullable SDThumbnailedKeyForKey(NSString * _Nullable key, CGSize thumbnailPixelSize, BOOL preserveAspectRatio);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
A transformer protocol to transform the image load from cache or from download.
|
|
33
|
+
You can provide transformer to cache and manager (Through the `transformer` property or context option `SDWebImageContextImageTransformer`).
|
|
34
|
+
From v5.20, the transformer class also can be used on animated image frame post-transform logic, see `SDAnimatedImageView`.
|
|
35
|
+
|
|
36
|
+
@note The transform process is called from a global queue in order to not to block the main queue.
|
|
37
|
+
*/
|
|
38
|
+
@protocol SDImageTransformer <NSObject>
|
|
39
|
+
|
|
40
|
+
@optional
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
Defaults to YES if you don't implements this method.
|
|
44
|
+
We keep some metadata like Image Format (`sd_imageFormat`)/ Animated Loop Count (`sd_imageLoopCount`) via associated object on UIImage instance.
|
|
45
|
+
When transformer generate a new UIImage instance, in most cases you still want to keep these information. So this is what for during the image loading pipeline.
|
|
46
|
+
If the value is YES, we will keep and override the metadata **After you generate the UIImage**
|
|
47
|
+
If the value is NO, we will not touch the UIImage metadata and it's controlled by you during the generation. Read `UIImage+Medata.h` and pick the metadata you want for the new generated UIImage.
|
|
48
|
+
*/
|
|
49
|
+
@property (nonatomic, assign, readonly) BOOL preserveImageMetadata;
|
|
50
|
+
|
|
51
|
+
@required
|
|
52
|
+
/**
|
|
53
|
+
For each transformer, it must contains its cache key to used to store the image cache or query from the cache. This key will be appened after the original cache key generated by URL or from user.
|
|
54
|
+
Which means, the cache should match what your transformer logic do. The same `input image` + `transformer key`, should always generate the same `output image`.
|
|
55
|
+
|
|
56
|
+
@return The cache key to appended after the original cache key. Should not be nil.
|
|
57
|
+
*/
|
|
58
|
+
@property (nonatomic, copy, readonly, nonnull) NSString *transformerKey;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
Transform the image to another image.
|
|
62
|
+
|
|
63
|
+
@param image The image to be transformed
|
|
64
|
+
@param key The cache key associated to the image. This arg is a hint for image source, not always useful and should be nullable. In the future we will remove this arg.
|
|
65
|
+
@return The transformed image, or nil if transform failed
|
|
66
|
+
*/
|
|
67
|
+
- (nullable UIImage *)transformedImageWithImage:(nonnull UIImage *)image forKey:(nonnull NSString *)key API_DEPRECATED("The key arg will be removed in the future. Update your code and don't rely on that.", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED));
|
|
68
|
+
|
|
69
|
+
@end
|
|
70
|
+
|
|
71
|
+
#pragma mark - Pipeline
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
Pipeline transformer. Which you can bind multiple transformers together to let the image to be transformed one by one in order and generate the final image.
|
|
75
|
+
@note Because transformers are lightweight, if you want to append or arrange transformers, create another pipeline transformer instead. This class is considered as immutable.
|
|
76
|
+
*/
|
|
77
|
+
@interface SDImagePipelineTransformer : NSObject<SDImageTransformer>
|
|
78
|
+
/// For pipeline transformer, this property is readonly and always return NO. We handle each transformer's choice inside implementation
|
|
79
|
+
@property (nonatomic, assign, readonly) BOOL preserveImageMetadata;
|
|
80
|
+
/**
|
|
81
|
+
All transformers in pipeline
|
|
82
|
+
*/
|
|
83
|
+
@property (nonatomic, copy, readonly, nonnull) NSArray<id<SDImageTransformer>> *transformers;
|
|
84
|
+
|
|
85
|
+
- (nonnull instancetype)init NS_UNAVAILABLE;
|
|
86
|
+
+ (nonnull instancetype)new NS_UNAVAILABLE;
|
|
87
|
+
|
|
88
|
+
+ (nonnull instancetype)transformerWithTransformers:(nonnull NSArray<id<SDImageTransformer>> *)transformers;
|
|
89
|
+
|
|
90
|
+
@end
|
|
91
|
+
|
|
92
|
+
#pragma mark - Base
|
|
93
|
+
/// This is the base class for our built-in concrete transformers. You should not use this class directlly, use cconcrete subclass (like `SDImageRoundCornerTransformer`) instead.
|
|
94
|
+
@interface SDImageBaseTransformer : NSObject<SDImageTransformer>
|
|
95
|
+
/// For concrete transformer, this property is readwrite and defaults to YES. You can choose whether to preserve image metadata **After you generate the UIImage**
|
|
96
|
+
@property (nonatomic, assign, readwrite) BOOL preserveImageMetadata;
|
|
97
|
+
@end
|
|
98
|
+
|
|
99
|
+
// There are some built-in transformers based on the `UIImage+Transformer` category to provide the common image geometry, image blending and image effect process. Those transform are useful for static image only but you can create your own to support animated image as well.
|
|
100
|
+
// Because transformers are lightweight, these class are considered as immutable.
|
|
101
|
+
#pragma mark - Image Geometry
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
Image round corner transformer
|
|
105
|
+
*/
|
|
106
|
+
@interface SDImageRoundCornerTransformer: SDImageBaseTransformer
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
The radius of each corner oval. Values larger than half the
|
|
110
|
+
rectangle's width or height are clamped appropriately to
|
|
111
|
+
half the width or height.
|
|
112
|
+
*/
|
|
113
|
+
@property (nonatomic, assign, readonly) CGFloat cornerRadius;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
A bitmask value that identifies the corners that you want
|
|
117
|
+
rounded. You can use this parameter to round only a subset
|
|
118
|
+
of the corners of the rectangle.
|
|
119
|
+
*/
|
|
120
|
+
@property (nonatomic, assign, readonly) SDRectCorner corners;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
The inset border line width. Values larger than half the rectangle's
|
|
124
|
+
width or height are clamped appropriately to half the width
|
|
125
|
+
or height.
|
|
126
|
+
*/
|
|
127
|
+
@property (nonatomic, assign, readonly) CGFloat borderWidth;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
The border stroke color. nil means clear color.
|
|
131
|
+
*/
|
|
132
|
+
@property (nonatomic, strong, readonly, nullable) UIColor *borderColor;
|
|
133
|
+
|
|
134
|
+
- (nonnull instancetype)init NS_UNAVAILABLE;
|
|
135
|
+
+ (nonnull instancetype)new NS_UNAVAILABLE;
|
|
136
|
+
|
|
137
|
+
+ (nonnull instancetype)transformerWithRadius:(CGFloat)cornerRadius corners:(SDRectCorner)corners borderWidth:(CGFloat)borderWidth borderColor:(nullable UIColor *)borderColor;
|
|
138
|
+
|
|
139
|
+
@end
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
Image resizing transformer
|
|
143
|
+
*/
|
|
144
|
+
@interface SDImageResizingTransformer : SDImageBaseTransformer
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
The new size to be resized, values should be positive.
|
|
148
|
+
*/
|
|
149
|
+
@property (nonatomic, assign, readonly) CGSize size;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
The scale mode for image content.
|
|
153
|
+
*/
|
|
154
|
+
@property (nonatomic, assign, readonly) SDImageScaleMode scaleMode;
|
|
155
|
+
|
|
156
|
+
- (nonnull instancetype)init NS_UNAVAILABLE;
|
|
157
|
+
+ (nonnull instancetype)new NS_UNAVAILABLE;
|
|
158
|
+
|
|
159
|
+
+ (nonnull instancetype)transformerWithSize:(CGSize)size scaleMode:(SDImageScaleMode)scaleMode;
|
|
160
|
+
|
|
161
|
+
@end
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
Image cropping transformer
|
|
165
|
+
*/
|
|
166
|
+
@interface SDImageCroppingTransformer : SDImageBaseTransformer
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
Image's inner rect.
|
|
170
|
+
*/
|
|
171
|
+
@property (nonatomic, assign, readonly) CGRect rect;
|
|
172
|
+
|
|
173
|
+
- (nonnull instancetype)init NS_UNAVAILABLE;
|
|
174
|
+
+ (nonnull instancetype)new NS_UNAVAILABLE;
|
|
175
|
+
|
|
176
|
+
+ (nonnull instancetype)transformerWithRect:(CGRect)rect;
|
|
177
|
+
|
|
178
|
+
@end
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
Image flipping transformer
|
|
182
|
+
*/
|
|
183
|
+
@interface SDImageFlippingTransformer : SDImageBaseTransformer
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
YES to flip the image horizontally. ⇋
|
|
187
|
+
*/
|
|
188
|
+
@property (nonatomic, assign, readonly) BOOL horizontal;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
YES to flip the image vertically. ⥯
|
|
192
|
+
*/
|
|
193
|
+
@property (nonatomic, assign, readonly) BOOL vertical;
|
|
194
|
+
|
|
195
|
+
- (nonnull instancetype)init NS_UNAVAILABLE;
|
|
196
|
+
+ (nonnull instancetype)new NS_UNAVAILABLE;
|
|
197
|
+
|
|
198
|
+
+ (nonnull instancetype)transformerWithHorizontal:(BOOL)horizontal vertical:(BOOL)vertical;
|
|
199
|
+
|
|
200
|
+
@end
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
Image rotation transformer
|
|
204
|
+
*/
|
|
205
|
+
@interface SDImageRotationTransformer : SDImageBaseTransformer
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
Rotated radians in counterclockwise.⟲
|
|
209
|
+
*/
|
|
210
|
+
@property (nonatomic, assign, readonly) CGFloat angle;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
YES: new image's size is extend to fit all content.
|
|
214
|
+
NO: image's size will not change, content may be clipped.
|
|
215
|
+
*/
|
|
216
|
+
@property (nonatomic, assign, readonly) BOOL fitSize;
|
|
217
|
+
|
|
218
|
+
- (nonnull instancetype)init NS_UNAVAILABLE;
|
|
219
|
+
+ (nonnull instancetype)new NS_UNAVAILABLE;
|
|
220
|
+
|
|
221
|
+
+ (nonnull instancetype)transformerWithAngle:(CGFloat)angle fitSize:(BOOL)fitSize;
|
|
222
|
+
|
|
223
|
+
@end
|
|
224
|
+
|
|
225
|
+
#pragma mark - Image Blending
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
Image tint color transformer
|
|
229
|
+
*/
|
|
230
|
+
@interface SDImageTintTransformer : SDImageBaseTransformer
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
The tint color.
|
|
234
|
+
*/
|
|
235
|
+
@property (nonatomic, strong, readonly, nonnull) UIColor *tintColor;
|
|
236
|
+
/// The blend mode, defaults to `sourceIn` if you use the initializer without blend mode
|
|
237
|
+
@property (nonatomic, assign, readonly) CGBlendMode blendMode;
|
|
238
|
+
|
|
239
|
+
- (nonnull instancetype)init NS_UNAVAILABLE;
|
|
240
|
+
+ (nonnull instancetype)new NS_UNAVAILABLE;
|
|
241
|
+
|
|
242
|
+
+ (nonnull instancetype)transformerWithColor:(nonnull UIColor *)tintColor;
|
|
243
|
+
+ (nonnull instancetype)transformerWithColor:(nonnull UIColor *)tintColor blendMode:(CGBlendMode)blendMode;
|
|
244
|
+
|
|
245
|
+
@end
|
|
246
|
+
|
|
247
|
+
#pragma mark - Image Effect
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
Image blur effect transformer
|
|
251
|
+
*/
|
|
252
|
+
@interface SDImageBlurTransformer : SDImageBaseTransformer
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
The radius of the blur in points, 0 means no blur effect.
|
|
256
|
+
*/
|
|
257
|
+
@property (nonatomic, assign, readonly) CGFloat blurRadius;
|
|
258
|
+
|
|
259
|
+
- (nonnull instancetype)init NS_UNAVAILABLE;
|
|
260
|
+
+ (nonnull instancetype)new NS_UNAVAILABLE;
|
|
261
|
+
|
|
262
|
+
+ (nonnull instancetype)transformerWithRadius:(CGFloat)blurRadius;
|
|
263
|
+
|
|
264
|
+
@end
|
|
265
|
+
|
|
266
|
+
#if SD_UIKIT || SD_MAC
|
|
267
|
+
/**
|
|
268
|
+
Core Image filter transformer
|
|
269
|
+
*/
|
|
270
|
+
@interface SDImageFilterTransformer: SDImageBaseTransformer
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
The CIFilter to be applied to the image.
|
|
274
|
+
*/
|
|
275
|
+
@property (nonatomic, strong, readonly, nonnull) CIFilter *filter;
|
|
276
|
+
|
|
277
|
+
- (nonnull instancetype)init NS_UNAVAILABLE;
|
|
278
|
+
+ (nonnull instancetype)new NS_UNAVAILABLE;
|
|
279
|
+
|
|
280
|
+
+ (nonnull instancetype)transformerWithFilter:(nonnull CIFilter *)filter;
|
|
281
|
+
|
|
282
|
+
@end
|
|
283
|
+
#endif
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the SDWebImage package.
|
|
3
|
+
* (c) Olivier Poitrey <rs@dailymotion.com>
|
|
4
|
+
*
|
|
5
|
+
* For the full copyright and license information, please view the LICENSE
|
|
6
|
+
* file that was distributed with this source code.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#import "SDWebImageCompat.h"
|
|
10
|
+
|
|
11
|
+
@class SDImageCacheConfig;
|
|
12
|
+
/**
|
|
13
|
+
A protocol to allow custom memory cache used in SDImageCache.
|
|
14
|
+
*/
|
|
15
|
+
@protocol SDMemoryCache <NSObject>
|
|
16
|
+
|
|
17
|
+
@required
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
Create a new memory cache instance with the specify cache config. You can check `maxMemoryCost` and `maxMemoryCount` used for memory cache.
|
|
21
|
+
|
|
22
|
+
@param config The cache config to be used to create the cache.
|
|
23
|
+
@return The new memory cache instance.
|
|
24
|
+
*/
|
|
25
|
+
- (nonnull instancetype)initWithConfig:(nonnull SDImageCacheConfig *)config;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
Returns the value associated with a given key.
|
|
29
|
+
|
|
30
|
+
@param key An object identifying the value. If nil, just return nil.
|
|
31
|
+
@return The value associated with key, or nil if no value is associated with key.
|
|
32
|
+
*/
|
|
33
|
+
- (nullable id)objectForKey:(nonnull id)key;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
Sets the value of the specified key in the cache (0 cost).
|
|
37
|
+
|
|
38
|
+
@param object The object to be stored in the cache. If nil, it calls `removeObjectForKey:`.
|
|
39
|
+
@param key The key with which to associate the value. If nil, this method has no effect.
|
|
40
|
+
@discussion Unlike an NSMutableDictionary object, a cache does not copy the key
|
|
41
|
+
objects that are put into it.
|
|
42
|
+
*/
|
|
43
|
+
- (void)setObject:(nullable id)object forKey:(nonnull id)key;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
Sets the value of the specified key in the cache, and associates the key-value
|
|
47
|
+
pair with the specified cost.
|
|
48
|
+
|
|
49
|
+
@param object The object to store in the cache. If nil, it calls `removeObjectForKey`.
|
|
50
|
+
@param key The key with which to associate the value. If nil, this method has no effect.
|
|
51
|
+
@param cost The cost with which to associate the key-value pair.
|
|
52
|
+
@discussion Unlike an NSMutableDictionary object, a cache does not copy the key
|
|
53
|
+
objects that are put into it.
|
|
54
|
+
*/
|
|
55
|
+
- (void)setObject:(nullable id)object forKey:(nonnull id)key cost:(NSUInteger)cost;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
Removes the value of the specified key in the cache.
|
|
59
|
+
|
|
60
|
+
@param key The key identifying the value to be removed. If nil, this method has no effect.
|
|
61
|
+
*/
|
|
62
|
+
- (void)removeObjectForKey:(nonnull id)key;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
Empties the cache immediately.
|
|
66
|
+
*/
|
|
67
|
+
- (void)removeAllObjects;
|
|
68
|
+
|
|
69
|
+
@end
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
A memory cache which auto purge the cache on memory warning and support weak cache.
|
|
73
|
+
*/
|
|
74
|
+
@interface SDMemoryCache <KeyType, ObjectType> : NSCache <KeyType, ObjectType> <SDMemoryCache>
|
|
75
|
+
|
|
76
|
+
@property (nonatomic, strong, nonnull, readonly) SDImageCacheConfig *config;
|
|
77
|
+
|
|
78
|
+
@end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the SDWebImage package.
|
|
3
|
+
* (c) Olivier Poitrey <rs@dailymotion.com>
|
|
4
|
+
* (c) Florent Vilmart
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#import <SDWebImage/SDWebImageCompat.h>
|
|
11
|
+
|
|
12
|
+
//! Project version number for SDWebImage.
|
|
13
|
+
FOUNDATION_EXPORT double SDWebImageVersionNumber;
|
|
14
|
+
|
|
15
|
+
//! Project version string for SDWebImage.
|
|
16
|
+
FOUNDATION_EXPORT const unsigned char SDWebImageVersionString[];
|
|
17
|
+
|
|
18
|
+
// In this header, you should import all the public headers of your framework using statements like #import <SDWebImage/PublicHeader.h>
|
|
19
|
+
|
|
20
|
+
#import <SDWebImage/SDWebImageManager.h>
|
|
21
|
+
#import <SDWebImage/SDCallbackQueue.h>
|
|
22
|
+
#import <SDWebImage/SDWebImageCacheKeyFilter.h>
|
|
23
|
+
#import <SDWebImage/SDWebImageCacheSerializer.h>
|
|
24
|
+
#import <SDWebImage/SDImageCacheConfig.h>
|
|
25
|
+
#import <SDWebImage/SDImageCache.h>
|
|
26
|
+
#import <SDWebImage/SDMemoryCache.h>
|
|
27
|
+
#import <SDWebImage/SDDiskCache.h>
|
|
28
|
+
#import <SDWebImage/SDImageCacheDefine.h>
|
|
29
|
+
#import <SDWebImage/SDImageCachesManager.h>
|
|
30
|
+
#import <SDWebImage/UIView+WebCache.h>
|
|
31
|
+
#import <SDWebImage/UIImageView+WebCache.h>
|
|
32
|
+
#import <SDWebImage/UIImageView+HighlightedWebCache.h>
|
|
33
|
+
#import <SDWebImage/SDWebImageDownloaderConfig.h>
|
|
34
|
+
#import <SDWebImage/SDWebImageDownloaderOperation.h>
|
|
35
|
+
#import <SDWebImage/SDWebImageDownloaderRequestModifier.h>
|
|
36
|
+
#import <SDWebImage/SDWebImageDownloaderResponseModifier.h>
|
|
37
|
+
#import <SDWebImage/SDWebImageDownloaderDecryptor.h>
|
|
38
|
+
#import <SDWebImage/SDImageLoader.h>
|
|
39
|
+
#import <SDWebImage/SDImageLoadersManager.h>
|
|
40
|
+
#import <SDWebImage/UIButton+WebCache.h>
|
|
41
|
+
#import <SDWebImage/SDWebImagePrefetcher.h>
|
|
42
|
+
#import <SDWebImage/UIView+WebCacheOperation.h>
|
|
43
|
+
#import <SDWebImage/UIView+WebCacheState.h>
|
|
44
|
+
#import <SDWebImage/UIImage+Metadata.h>
|
|
45
|
+
#import <SDWebImage/UIImage+MultiFormat.h>
|
|
46
|
+
#import <SDWebImage/UIImage+MemoryCacheCost.h>
|
|
47
|
+
#import <SDWebImage/UIImage+ExtendedCacheData.h>
|
|
48
|
+
#import <SDWebImage/SDWebImageOperation.h>
|
|
49
|
+
#import <SDWebImage/SDWebImageDownloader.h>
|
|
50
|
+
#import <SDWebImage/SDWebImageTransition.h>
|
|
51
|
+
#import <SDWebImage/SDWebImageIndicator.h>
|
|
52
|
+
#import <SDWebImage/SDImageTransformer.h>
|
|
53
|
+
#import <SDWebImage/UIImage+Transform.h>
|
|
54
|
+
#import <SDWebImage/SDAnimatedImage.h>
|
|
55
|
+
#import <SDWebImage/SDAnimatedImageView.h>
|
|
56
|
+
#import <SDWebImage/SDAnimatedImageView+WebCache.h>
|
|
57
|
+
#import <SDWebImage/SDAnimatedImagePlayer.h>
|
|
58
|
+
#import <SDWebImage/SDImageCodersManager.h>
|
|
59
|
+
#import <SDWebImage/SDImageCoder.h>
|
|
60
|
+
#import <SDWebImage/SDImageAPNGCoder.h>
|
|
61
|
+
#import <SDWebImage/SDImageGIFCoder.h>
|
|
62
|
+
#import <SDWebImage/SDImageIOCoder.h>
|
|
63
|
+
#import <SDWebImage/SDImageFrame.h>
|
|
64
|
+
#import <SDWebImage/SDImageCoderHelper.h>
|
|
65
|
+
#import <SDWebImage/SDImageGraphics.h>
|
|
66
|
+
#import <SDWebImage/SDGraphicsImageRenderer.h>
|
|
67
|
+
#import <SDWebImage/UIImage+GIF.h>
|
|
68
|
+
#import <SDWebImage/UIImage+ForceDecode.h>
|
|
69
|
+
#import <SDWebImage/NSData+ImageContentType.h>
|
|
70
|
+
#import <SDWebImage/SDWebImageDefine.h>
|
|
71
|
+
#import <SDWebImage/SDWebImageError.h>
|
|
72
|
+
#import <SDWebImage/SDWebImageOptionsProcessor.h>
|
|
73
|
+
#import <SDWebImage/SDImageIOAnimatedCoder.h>
|
|
74
|
+
#import <SDWebImage/SDImageHEICCoder.h>
|
|
75
|
+
#import <SDWebImage/SDImageAWebPCoder.h>
|
|
76
|
+
|
|
77
|
+
// Mac
|
|
78
|
+
#if __has_include(<SDWebImage/NSImage+Compatibility.h>)
|
|
79
|
+
#import <SDWebImage/NSImage+Compatibility.h>
|
|
80
|
+
#endif
|
|
81
|
+
#if __has_include(<SDWebImage/NSButton+WebCache.h>)
|
|
82
|
+
#import <SDWebImage/NSButton+WebCache.h>
|
|
83
|
+
#endif
|
|
84
|
+
#if __has_include(<SDWebImage/SDAnimatedImageRep.h>)
|
|
85
|
+
#import <SDWebImage/SDAnimatedImageRep.h>
|
|
86
|
+
#endif
|
|
87
|
+
|
|
88
|
+
// MapKit
|
|
89
|
+
#if __has_include(<SDWebImage/MKAnnotationView+WebCache.h>)
|
|
90
|
+
#import <SDWebImage/MKAnnotationView+WebCache.h>
|
|
91
|
+
#endif
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the SDWebImage package.
|
|
3
|
+
* (c) Olivier Poitrey <rs@dailymotion.com>
|
|
4
|
+
*
|
|
5
|
+
* For the full copyright and license information, please view the LICENSE
|
|
6
|
+
* file that was distributed with this source code.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import "SDWebImageCompat.h"
|
|
11
|
+
|
|
12
|
+
typedef NSString * _Nullable(^SDWebImageCacheKeyFilterBlock)(NSURL * _Nonnull url);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
This is the protocol for cache key filter.
|
|
16
|
+
We can use a block to specify the cache key filter. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options.
|
|
17
|
+
*/
|
|
18
|
+
@protocol SDWebImageCacheKeyFilter <NSObject>
|
|
19
|
+
|
|
20
|
+
- (nullable NSString *)cacheKeyForURL:(nonnull NSURL *)url;
|
|
21
|
+
|
|
22
|
+
@end
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
A cache key filter class with block.
|
|
26
|
+
*/
|
|
27
|
+
@interface SDWebImageCacheKeyFilter : NSObject <SDWebImageCacheKeyFilter>
|
|
28
|
+
|
|
29
|
+
- (nonnull instancetype)init NS_UNAVAILABLE;
|
|
30
|
+
+ (nonnull instancetype)new NS_UNAVAILABLE;
|
|
31
|
+
|
|
32
|
+
- (nonnull instancetype)initWithBlock:(nonnull SDWebImageCacheKeyFilterBlock)block;
|
|
33
|
+
+ (nonnull instancetype)cacheKeyFilterWithBlock:(nonnull SDWebImageCacheKeyFilterBlock)block;
|
|
34
|
+
|
|
35
|
+
@end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the SDWebImage package.
|
|
3
|
+
* (c) Olivier Poitrey <rs@dailymotion.com>
|
|
4
|
+
*
|
|
5
|
+
* For the full copyright and license information, please view the LICENSE
|
|
6
|
+
* file that was distributed with this source code.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import "SDWebImageCompat.h"
|
|
11
|
+
|
|
12
|
+
typedef NSData * _Nullable(^SDWebImageCacheSerializerBlock)(UIImage * _Nonnull image, NSData * _Nullable data, NSURL * _Nullable imageURL);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
This is the protocol for cache serializer.
|
|
16
|
+
We can use a block to specify the cache serializer. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options.
|
|
17
|
+
*/
|
|
18
|
+
@protocol SDWebImageCacheSerializer <NSObject>
|
|
19
|
+
|
|
20
|
+
/// Provide the image data associated to the image and store to disk cache
|
|
21
|
+
/// @param image The loaded image
|
|
22
|
+
/// @param data The original loaded image data. May be nil when image is transformed (UIImage.sd_isTransformed = YES)
|
|
23
|
+
/// @param imageURL The image URL
|
|
24
|
+
- (nullable NSData *)cacheDataWithImage:(nonnull UIImage *)image originalData:(nullable NSData *)data imageURL:(nullable NSURL *)imageURL;
|
|
25
|
+
|
|
26
|
+
@end
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
A cache serializer class with block.
|
|
30
|
+
*/
|
|
31
|
+
@interface SDWebImageCacheSerializer : NSObject <SDWebImageCacheSerializer>
|
|
32
|
+
|
|
33
|
+
- (nonnull instancetype)initWithBlock:(nonnull SDWebImageCacheSerializerBlock)block;
|
|
34
|
+
+ (nonnull instancetype)cacheSerializerWithBlock:(nonnull SDWebImageCacheSerializerBlock)block;
|
|
35
|
+
|
|
36
|
+
- (nonnull instancetype)init NS_UNAVAILABLE;
|
|
37
|
+
+ (nonnull instancetype)new NS_UNAVAILABLE;
|
|
38
|
+
|
|
39
|
+
@end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the SDWebImage package.
|
|
3
|
+
* (c) Olivier Poitrey <rs@dailymotion.com>
|
|
4
|
+
* (c) Jamie Pinkham
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#import <TargetConditionals.h>
|
|
11
|
+
|
|
12
|
+
#ifdef __OBJC_GC__
|
|
13
|
+
#error SDWebImage does not support Objective-C Garbage Collection
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Seems like TARGET_OS_MAC is always defined (on all platforms).
|
|
17
|
+
// To determine if we are running on macOS, use TARGET_OS_OSX in Xcode 8
|
|
18
|
+
#if TARGET_OS_OSX
|
|
19
|
+
#define SD_MAC 1
|
|
20
|
+
#else
|
|
21
|
+
#define SD_MAC 0
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
#if TARGET_OS_IOS
|
|
25
|
+
#define SD_IOS 1
|
|
26
|
+
#else
|
|
27
|
+
#define SD_IOS 0
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
#if TARGET_OS_TV
|
|
31
|
+
#define SD_TV 1
|
|
32
|
+
#else
|
|
33
|
+
#define SD_TV 0
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
#if TARGET_OS_WATCH
|
|
37
|
+
#define SD_WATCH 1
|
|
38
|
+
#else
|
|
39
|
+
#define SD_WATCH 0
|
|
40
|
+
#endif
|
|
41
|
+
|
|
42
|
+
// Supports Xcode 14 to suppress warning
|
|
43
|
+
#ifdef TARGET_OS_VISION
|
|
44
|
+
#if TARGET_OS_VISION
|
|
45
|
+
#define SD_VISION 1
|
|
46
|
+
#endif
|
|
47
|
+
#endif
|
|
48
|
+
|
|
49
|
+
// iOS/tvOS/visionOS are very similar, UIKit exists on both platforms
|
|
50
|
+
// Note: watchOS also has UIKit, but it's very limited
|
|
51
|
+
#if SD_IOS || SD_TV || SD_VISION
|
|
52
|
+
#define SD_UIKIT 1
|
|
53
|
+
#else
|
|
54
|
+
#define SD_UIKIT 0
|
|
55
|
+
#endif
|
|
56
|
+
|
|
57
|
+
#if SD_MAC
|
|
58
|
+
#import <AppKit/AppKit.h>
|
|
59
|
+
#ifndef UIImage
|
|
60
|
+
#define UIImage NSImage
|
|
61
|
+
#endif
|
|
62
|
+
#ifndef UIImageView
|
|
63
|
+
#define UIImageView NSImageView
|
|
64
|
+
#endif
|
|
65
|
+
#ifndef UIView
|
|
66
|
+
#define UIView NSView
|
|
67
|
+
#endif
|
|
68
|
+
#ifndef UIColor
|
|
69
|
+
#define UIColor NSColor
|
|
70
|
+
#endif
|
|
71
|
+
#else
|
|
72
|
+
#if SD_UIKIT
|
|
73
|
+
#import <UIKit/UIKit.h>
|
|
74
|
+
#endif
|
|
75
|
+
#if SD_WATCH
|
|
76
|
+
#import <WatchKit/WatchKit.h>
|
|
77
|
+
#ifndef UIView
|
|
78
|
+
#define UIView WKInterfaceObject
|
|
79
|
+
#endif
|
|
80
|
+
#ifndef UIImageView
|
|
81
|
+
#define UIImageView WKInterfaceImage
|
|
82
|
+
#endif
|
|
83
|
+
#endif
|
|
84
|
+
#endif
|
|
85
|
+
|
|
86
|
+
#ifndef NS_ENUM
|
|
87
|
+
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
|
|
88
|
+
#endif
|
|
89
|
+
|
|
90
|
+
#ifndef NS_OPTIONS
|
|
91
|
+
#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
|
|
92
|
+
#endif
|
|
93
|
+
|
|
94
|
+
#ifndef dispatch_main_async_safe
|
|
95
|
+
#define dispatch_main_async_safe(block)\
|
|
96
|
+
if (dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(dispatch_get_main_queue())) {\
|
|
97
|
+
block();\
|
|
98
|
+
} else {\
|
|
99
|
+
dispatch_async(dispatch_get_main_queue(), block);\
|
|
100
|
+
}
|
|
101
|
+
#pragma clang deprecated(dispatch_main_async_safe, "Use SDCallbackQueue instead")
|
|
102
|
+
#endif
|