@momo-kits/native-kits 0.0.1-beta.5 → 0.89.1-2

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.
Files changed (406) hide show
  1. package/README.md +1 -0
  2. package/android/.gradle/8.0/checksums/checksums.lock +0 -0
  3. package/android/.gradle/8.0/dependencies-accessors/dependencies-accessors.lock +0 -0
  4. package/android/.gradle/8.0/dependencies-accessors/gc.properties +0 -0
  5. package/android/.gradle/8.0/fileChanges/last-build.bin +0 -0
  6. package/android/.gradle/8.0/fileHashes/fileHashes.lock +0 -0
  7. package/android/.gradle/8.0/gc.properties +0 -0
  8. package/android/.gradle/config.properties +2 -0
  9. package/android/.gradle/vcs-1/gc.properties +0 -0
  10. package/android/.idea/gradle.xml +12 -0
  11. package/android/.idea/migrations.xml +10 -0
  12. package/android/.idea/misc.xml +10 -0
  13. package/android/.idea/vcs.xml +6 -0
  14. package/android/.idea/workspace.xml +50 -0
  15. package/android/build.gradle +35 -69
  16. package/android/local.properties +8 -0
  17. package/android/proguard-rules.pro +21 -0
  18. package/android/src/main/AndroidManifest.xml +2 -2
  19. package/android/src/main/java/com/momoplatform/nativekits/foundations/Button.kt +16 -0
  20. package/android/src/main/java/com/momoplatform/nativekits/libs/Logo.kt +63 -0
  21. package/android/src/main/java/com/momoplatform/nativekits/libs/TrustBanner.kt +246 -0
  22. package/android/src/main/res/drawable/ic_launcher_background.xml +170 -0
  23. package/android/src/main/res/drawable-v24/ic_launcher_foreground.xml +30 -0
  24. package/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +6 -0
  25. package/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +6 -0
  26. package/android/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
  27. package/android/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
  28. package/android/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
  29. package/android/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
  30. package/android/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
  31. package/android/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
  32. package/android/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
  33. package/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
  34. package/android/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
  35. package/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
  36. package/android/src/main/res/values/colors.xml +10 -0
  37. package/android/src/main/res/values/strings.xml +3 -0
  38. package/android/src/main/res/values/themes.xml +3 -0
  39. package/android/src/main/res/values-night/themes.xml +3 -0
  40. package/android/src/main/res/xml/backup_rules.xml +13 -0
  41. package/android/src/main/res/xml/data_extraction_rules.xml +19 -0
  42. package/build.gradle.kts +18 -0
  43. package/compose/build.gradle.kts +82 -0
  44. package/compose/src/androidMain/AndroidManifest.xml +2 -0
  45. package/compose/src/androidMain/kotlin/vn/momo/kits/utils/Platform.kt +3 -0
  46. package/compose/src/androidMain/kotlin/vn/momo/kits/utils/SetMaskFilter.kt +8 -0
  47. package/compose/src/androidMain/kotlin/vn/momo/kits/utils/Utils.android.kt +14 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Components.kt +194 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +197 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +133 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +62 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +27 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +288 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +80 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +42 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +126 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +51 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +299 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +246 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +223 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +244 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +281 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PromotionPopup.kt +72 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +65 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +64 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +63 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +73 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +42 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +150 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +13 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +173 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +242 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +2 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +50 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1321 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Platform.kt +3 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/SetMaskFilter.kt +5 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +97 -0
  83. package/compose/src/iosMain/kotlin/vn/momo/kits/utils/Platform.kt +3 -0
  84. package/compose/src/iosMain/kotlin/vn/momo/kits/utils/SetMaskFilter.kt +9 -0
  85. package/compose/src/iosMain/kotlin/vn/momo/kits/utils/Utils.ios.kt +18 -0
  86. package/gradle.properties +19 -0
  87. package/gradlew +240 -0
  88. package/gradlew.bat +91 -0
  89. package/ios/Button/Button.swift +9 -2
  90. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +126 -0
  91. package/ios/Colors+Radius+Spacing/Colors.swift +21 -19
  92. package/ios/Input/Input.swift +1 -0
  93. package/ios/OTPKeyboard/KeyboardButton.swift +12 -4
  94. package/ios/Popup/PopupDisplay.swift +72 -81
  95. package/ios/Popup/PopupInput.swift +96 -0
  96. package/ios/Popup/PopupPromotion.swift +52 -0
  97. package/ios/ScrollIndicator/ScrollIndicator.swift +79 -0
  98. package/ios/Template/Logo/Logo.swift +75 -0
  99. package/ios/Template/TrustBanner/TrustBanner.swift +189 -0
  100. package/ios/native-kits.podspec +1 -1
  101. package/local.properties +8 -0
  102. package/package.json +6 -6
  103. package/publish.sh +1 -10
  104. package/settings.gradle.kts +41 -0
  105. package/android/gradle.properties +0 -5
  106. package/android/src/main/java/com/momoplatform/nativekits/NativeKitsPackage.kt +0 -17
  107. package/android/src/main/java/com/momoplatform/nativekits/NativeKitsViewManager.kt +0 -20
  108. package/example/ios/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -63
  109. package/example/ios/Example/Assets.xcassets/Background.colorset/Contents.json +0 -38
  110. package/example/ios/Example/Assets.xcassets/Border.colorset/Contents.json +0 -38
  111. package/example/ios/Example/Assets.xcassets/Card.colorset/Contents.json +0 -38
  112. package/example/ios/Example/Assets.xcassets/Contents.json +0 -6
  113. package/example/ios/Example/Assets.xcassets/Error.colorset/Contents.json +0 -38
  114. package/example/ios/Example/Assets.xcassets/Primary.colorset/Contents.json +0 -38
  115. package/example/ios/Example/Assets.xcassets/PrimaryDark.colorset/Contents.json +0 -38
  116. package/example/ios/Example/Assets.xcassets/PrimaryLight.colorset/Contents.json +0 -38
  117. package/example/ios/Example/Assets.xcassets/Secondary.colorset/Contents.json +0 -38
  118. package/example/ios/Example/Assets.xcassets/Success.colorset/Contents.json +0 -38
  119. package/example/ios/Example/Assets.xcassets/Text.colorset/Contents.json +0 -38
  120. package/example/ios/Example/Assets.xcassets/TextSecondary.colorset/Contents.json +0 -38
  121. package/example/ios/Example/Assets.xcassets/Warning.colorset/Contents.json +0 -38
  122. package/example/ios/Example/ComponentDetail.swift +0 -35
  123. package/example/ios/Example/ComponentItem.swift +0 -24
  124. package/example/ios/Example/ComponentModel.swift +0 -38
  125. package/example/ios/Example/ContentView.swift +0 -39
  126. package/example/ios/Example/Example.entitlements +0 -10
  127. package/example/ios/Example/Foundation/ButtonDemo.swift +0 -80
  128. package/example/ios/Example/Foundation/ImageDemo.swift +0 -43
  129. package/example/ios/Example/Foundation/Popup/ActionSheets.swift +0 -136
  130. package/example/ios/Example/Foundation/Popup/Floats.swift +0 -127
  131. package/example/ios/Example/Foundation/Popup/Popups.swift +0 -51
  132. package/example/ios/Example/Foundation/PopupDemo.swift +0 -389
  133. package/example/ios/Example/Foundation/TextInputDemo.swift +0 -36
  134. package/example/ios/Example/Foundation/TypographyDemo.swift +0 -53
  135. package/example/ios/Example/Foundation.swift +0 -26
  136. package/example/ios/Example/Info.plist +0 -18
  137. package/example/ios/Example/Library/CheckboxDemo.swift +0 -19
  138. package/example/ios/Example/Library/SwipeableDemo.swift +0 -105
  139. package/example/ios/Example/Library/SwitchDemo.swift +0 -19
  140. package/example/ios/Example/Library.swift +0 -26
  141. package/example/ios/Example/Main.swift +0 -27
  142. package/example/ios/Example/Overview.swift +0 -20
  143. package/example/ios/Example/Preview Content/Preview Assets.xcassets/Contents.json +0 -6
  144. package/example/ios/Example/Resource/SFProText-Black.ttf +0 -0
  145. package/example/ios/Example/Resource/SFProText-Bold.ttf +0 -0
  146. package/example/ios/Example/Resource/SFProText-Heavy.ttf +0 -0
  147. package/example/ios/Example/Resource/SFProText-Light.ttf +0 -0
  148. package/example/ios/Example/Resource/SFProText-Medium.ttf +0 -0
  149. package/example/ios/Example/Resource/SFProText-Regular.ttf +0 -0
  150. package/example/ios/Example/Resource/SFProText-Semibold.ttf +0 -0
  151. package/example/ios/Example/Resource/SFProText-Thin.ttf +0 -0
  152. package/example/ios/Example/Resource/SFProText-Ultralight.ttf +0 -0
  153. package/example/ios/Example/Resource/foundation.json +0 -33
  154. package/example/ios/Example/Resource/library.json +0 -18
  155. package/example/ios/Example/Utils.swift +0 -30
  156. package/example/ios/Example/ViewModifier/DarkViewModifier.swift +0 -22
  157. package/example/ios/Example.xcodeproj/project.pbxproj +0 -581
  158. package/example/ios/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  159. package/example/ios/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  160. package/example/ios/Example.xcodeproj/project.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  161. package/example/ios/Example.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  162. package/example/ios/Example.xcworkspace/contents.xcworkspacedata +0 -10
  163. package/example/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  164. package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  165. package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
  166. package/example/ios/Podfile +0 -7
  167. package/example/ios/Podfile.lock +0 -35
  168. package/example/ios/Pods/Local Podspecs/MoMoUIKits.podspec.json +0 -37
  169. package/example/ios/Pods/Manifest.lock +0 -35
  170. package/example/ios/Pods/Pods.xcodeproj/project.pbxproj +0 -2047
  171. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
  172. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
  173. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/SDWebImage.xcscheme +0 -58
  174. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +0 -58
  175. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/SkeletonUI.xcscheme +0 -58
  176. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +0 -46
  177. package/example/ios/Pods/SDWebImage/LICENSE +0 -20
  178. package/example/ios/Pods/SDWebImage/README.md +0 -352
  179. package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.h +0 -340
  180. package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.m +0 -172
  181. package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.h +0 -63
  182. package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.m +0 -165
  183. package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.h +0 -67
  184. package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.m +0 -120
  185. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.h +0 -114
  186. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.m +0 -392
  187. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.h +0 -112
  188. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.m +0 -420
  189. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.h +0 -23
  190. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.m +0 -133
  191. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.h +0 -168
  192. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.m +0 -79
  193. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.h +0 -110
  194. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.m +0 -540
  195. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.h +0 -145
  196. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m +0 -326
  197. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.h +0 -73
  198. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.m +0 -256
  199. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.h +0 -19
  200. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.m +0 -58
  201. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.h +0 -23
  202. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.m +0 -98
  203. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCache.h +0 -450
  204. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCache.m +0 -1030
  205. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.h +0 -153
  206. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.m +0 -68
  207. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.h +0 -156
  208. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.m +0 -138
  209. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.h +0 -81
  210. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.m +0 -556
  211. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.h +0 -297
  212. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.m +0 -26
  213. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.h +0 -153
  214. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.m +0 -822
  215. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.h +0 -58
  216. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.m +0 -130
  217. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.h +0 -36
  218. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.m +0 -28
  219. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.h +0 -22
  220. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.m +0 -58
  221. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.h +0 -28
  222. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.m +0 -127
  223. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.h +0 -25
  224. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.m +0 -101
  225. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.h +0 -58
  226. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.m +0 -807
  227. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.h +0 -30
  228. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.m +0 -420
  229. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.h +0 -146
  230. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.m +0 -170
  231. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.h +0 -40
  232. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.m +0 -123
  233. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.h +0 -241
  234. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.m +0 -331
  235. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.h +0 -78
  236. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.m +0 -158
  237. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.h +0 -32
  238. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.m +0 -39
  239. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.h +0 -36
  240. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.m +0 -39
  241. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.h +0 -95
  242. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.m +0 -17
  243. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.h +0 -352
  244. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.m +0 -149
  245. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.h +0 -314
  246. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.m +0 -658
  247. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.h +0 -113
  248. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.m +0 -60
  249. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.h +0 -49
  250. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.m +0 -55
  251. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.h +0 -191
  252. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.m +0 -722
  253. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h +0 -69
  254. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.m +0 -71
  255. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h +0 -69
  256. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m +0 -73
  257. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.h +0 -32
  258. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.m +0 -16
  259. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.h +0 -115
  260. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.m +0 -275
  261. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.h +0 -290
  262. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.m +0 -775
  263. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.h +0 -27
  264. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.m +0 -14
  265. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.h +0 -72
  266. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.m +0 -59
  267. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.h +0 -143
  268. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.m +0 -303
  269. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.h +0 -131
  270. package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.m +0 -194
  271. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.h +0 -387
  272. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.m +0 -234
  273. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.h +0 -24
  274. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.m +0 -23
  275. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.h +0 -46
  276. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.m +0 -60
  277. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.h +0 -26
  278. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.m +0 -22
  279. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.h +0 -27
  280. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.m +0 -47
  281. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.h +0 -89
  282. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.m +0 -221
  283. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.h +0 -80
  284. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.m +0 -47
  285. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.h +0 -146
  286. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.m +0 -824
  287. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.h +0 -129
  288. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.m +0 -76
  289. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.h +0 -194
  290. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.m +0 -67
  291. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.h +0 -110
  292. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.m +0 -446
  293. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.h +0 -48
  294. package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.m +0 -82
  295. package/example/ios/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h +0 -24
  296. package/example/ios/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.m +0 -42
  297. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.h +0 -14
  298. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.m +0 -29
  299. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.h +0 -21
  300. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.m +0 -92
  301. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.h +0 -18
  302. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.m +0 -32
  303. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.h +0 -29
  304. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.m +0 -227
  305. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.h +0 -19
  306. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.m +0 -127
  307. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.h +0 -23
  308. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.m +0 -164
  309. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.h +0 -21
  310. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.m +0 -83
  311. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h +0 -39
  312. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.h +0 -122
  313. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.m +0 -13
  314. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.h +0 -20
  315. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.m +0 -79
  316. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDWebImageTransitionInternal.h +0 -19
  317. package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDmetamacros.h +0 -667
  318. package/example/ios/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.h +0 -18
  319. package/example/ios/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.m +0 -42
  320. package/example/ios/Pods/SDWebImage/WebImage/SDWebImage.h +0 -89
  321. package/example/ios/Pods/SDWebImageSwiftUI/LICENSE +0 -19
  322. package/example/ios/Pods/SDWebImageSwiftUI/README.md +0 -690
  323. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/AnimatedImage.swift +0 -870
  324. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/Backport.swift +0 -59
  325. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/OnChange.swift +0 -52
  326. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/Overlay.swift +0 -124
  327. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/StateObject.swift +0 -151
  328. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Image.swift +0 -78
  329. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImageManager.swift +0 -132
  330. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImagePlayer.swift +0 -122
  331. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImageViewWrapper.swift +0 -133
  332. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/ActivityIndicator.swift +0 -82
  333. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/Indicator.swift +0 -97
  334. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/ProgressIndicator.swift +0 -114
  335. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/SDWebImageSwiftUI.swift +0 -64
  336. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/SwiftUICompatibility.swift +0 -92
  337. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Transition/Transition.swift +0 -93
  338. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/WebImage.swift +0 -509
  339. package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Module/SDWebImageSwiftUI.h +0 -15
  340. package/example/ios/Pods/SkeletonUI/LICENSE +0 -21
  341. package/example/ios/Pods/SkeletonUI/README.md +0 -137
  342. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Angle/AngleInteractor.swift +0 -29
  343. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Angle/AnglePresenter.swift +0 -7
  344. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Animation/AnimationInteractor.swift +0 -56
  345. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Appearance/AppearanceInteractor.swift +0 -58
  346. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Appearance/AppearancePresenter.swift +0 -5
  347. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/ClosedRange+Normalize.swift +0 -16
  348. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Image+OptionalType.swift +0 -102
  349. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/ModifiedContent+SkeletonModifier.swift +0 -26
  350. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Optional+OptionalType.swift +0 -5
  351. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/SecureField+OptionalType.swift +0 -19
  352. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Text+OptionalType.swift +0 -27
  353. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/TextField+OptionalType.swift +0 -35
  354. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Toggle+OptionalType.swift +0 -29
  355. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/UnitPoint+Angle.swift +0 -8
  356. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/View+SkeletonModifier.swift +0 -8
  357. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Modifiers/SkeletonModifier.swift +0 -52
  358. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Multiline/MultilineInteractor.swift +0 -41
  359. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Multiline/MultilinePresenter.swift +0 -9
  360. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Opacity/OpacityInteractor.swift +0 -29
  361. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Opacity/OpacityPresenter.swift +0 -7
  362. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Position/PositionInteractor.swift +0 -29
  363. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Position/PositionPresenter.swift +0 -7
  364. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Protocols/OptionalType.swift +0 -4
  365. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Radius/RadiusInteractor.swift +0 -29
  366. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Radius/RadiusPresenter.swift +0 -7
  367. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Shape/ShapeInteractor.swift +0 -33
  368. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Shape/ShapePresenter.swift +0 -5
  369. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonForEach.swift +0 -20
  370. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonInteractor.swift +0 -27
  371. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonList.swift +0 -20
  372. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonPresenter.swift +0 -15
  373. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonShape.swift +0 -64
  374. package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonView.swift +0 -25
  375. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-dummy.m +0 -5
  376. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-prefix.pch +0 -12
  377. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-umbrella.h +0 -16
  378. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.debug.xcconfig +0 -15
  379. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.modulemap +0 -6
  380. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.release.xcconfig +0 -15
  381. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.markdown +0 -75
  382. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.plist +0 -119
  383. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-dummy.m +0 -5
  384. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-umbrella.h +0 -16
  385. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig +0 -15
  386. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.modulemap +0 -6
  387. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig +0 -15
  388. package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m +0 -5
  389. package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch +0 -12
  390. package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h +0 -75
  391. package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage.debug.xcconfig +0 -14
  392. package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage.modulemap +0 -6
  393. package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage.release.xcconfig +0 -14
  394. package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-dummy.m +0 -5
  395. package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-prefix.pch +0 -12
  396. package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-umbrella.h +0 -17
  397. package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.debug.xcconfig +0 -17
  398. package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.modulemap +0 -6
  399. package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.release.xcconfig +0 -17
  400. package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI-dummy.m +0 -5
  401. package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI-prefix.pch +0 -12
  402. package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI-umbrella.h +0 -16
  403. package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI.debug.xcconfig +0 -12
  404. package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI.modulemap +0 -6
  405. package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI.release.xcconfig +0 -12
  406. package/ios/Extensions/View++.swift +0 -9
@@ -1,870 +0,0 @@
1
- /*
2
- * This file is part of the SDWebImage package.
3
- * (c) DreamPiggy <lizhuoli1126@126.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 SwiftUI
10
- import SDWebImage
11
-
12
- #if os(iOS) || os(tvOS) || os(macOS)
13
-
14
- /// A coordinator object used for `AnimatedImage`native view bridge for UIKit/AppKit.
15
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
16
- public final class AnimatedImageCoordinator: NSObject {
17
-
18
- /// Any user-provided object for actual coordinator, such as delegate method, taget-action
19
- public var object: Any?
20
-
21
- /// Any user-provided info stored into coordinator, such as status value used for coordinator
22
- public var userInfo: [AnyHashable : Any]?
23
-
24
- var imageLoading = AnimatedLoadingModel()
25
- }
26
-
27
- /// Data Binding Object, only properties in this object can support changes from user with @State and refresh
28
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
29
- final class AnimatedImageModel : ObservableObject {
30
- /// URL image
31
- @Published var url: URL?
32
- @Published var webOptions: SDWebImageOptions = []
33
- @Published var webContext: [SDWebImageContextOption : Any]? = nil
34
- /// Name image
35
- @Published var name: String?
36
- @Published var bundle: Bundle?
37
- /// Data image
38
- @Published var data: Data?
39
- @Published var scale: CGFloat = 1
40
- }
41
-
42
- /// Loading Binding Object, only properties in this object can support changes from user with @State and refresh
43
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
44
- final class AnimatedLoadingModel : ObservableObject {
45
- @Published var image: PlatformImage? // loaded image, note when progressive loading, this will published multiple times with different partial image
46
- @Published var isLoading: Bool = false // whether network is loading or cache is querying, should only be used for indicator binding
47
- @Published var progress: Double = 0 // network progress, should only be used for indicator binding
48
-
49
- /// Used for loading status recording to avoid recursive `updateView`. There are 3 types of loading (Name/Data/URL)
50
- @Published var imageName: String?
51
- @Published var imageData: Data?
52
- @Published var imageURL: URL?
53
- }
54
-
55
- /// Completion Handler Binding Object, supports dynamic @State changes
56
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
57
- final class AnimatedImageHandler: ObservableObject {
58
- // Completion Handler
59
- @Published var successBlock: ((PlatformImage, Data?, SDImageCacheType) -> Void)?
60
- @Published var failureBlock: ((Error) -> Void)?
61
- @Published var progressBlock: ((Int, Int) -> Void)?
62
- // Coordinator Handler
63
- @Published var viewCreateBlock: ((PlatformView, AnimatedImage.Context) -> Void)?
64
- @Published var viewUpdateBlock: ((PlatformView, AnimatedImage.Context) -> Void)?
65
- }
66
-
67
- /// Layout Binding Object, supports dynamic @State changes
68
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
69
- final class AnimatedImageLayout : ObservableObject {
70
- var contentMode: ContentMode?
71
- var aspectRatio: CGFloat?
72
- var capInsets: EdgeInsets = EdgeInsets()
73
- var resizingMode: Image.ResizingMode?
74
- var renderingMode: Image.TemplateRenderingMode?
75
- var interpolation: Image.Interpolation?
76
- var antialiased: Bool = false
77
- }
78
-
79
- /// Configuration Binding Object, supports dynamic @State changes
80
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
81
- final class AnimatedImageConfiguration: ObservableObject {
82
- var incrementalLoad: Bool?
83
- var maxBufferSize: UInt?
84
- var customLoopCount: UInt?
85
- var runLoopMode: RunLoop.Mode?
86
- var pausable: Bool?
87
- var purgeable: Bool?
88
- var playbackRate: Double?
89
- var playbackMode: SDAnimatedImagePlaybackMode?
90
- // These configurations only useful for web image loading
91
- var indicator: SDWebImageIndicator?
92
- var transition: SDWebImageTransition?
93
- var placeholder: PlatformImage?
94
- var placeholderView: PlatformView? {
95
- didSet {
96
- oldValue?.removeFromSuperview()
97
- }
98
- }
99
- }
100
-
101
- /// A Image View type to load image from url, data or bundle. Supports animated and static image format.
102
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
103
- public struct AnimatedImage : PlatformViewRepresentable {
104
- @ObservedObject var imageModel: AnimatedImageModel
105
- @ObservedObject var imageHandler = AnimatedImageHandler()
106
- @ObservedObject var imageLayout = AnimatedImageLayout()
107
- @ObservedObject var imageConfiguration = AnimatedImageConfiguration()
108
-
109
- /// A observed object to pass through the image manager loading status to indicator
110
- @ObservedObject var indicatorStatus = IndicatorStatus()
111
-
112
- static var viewDestroyBlock: ((PlatformView, Coordinator) -> Void)?
113
-
114
- /// A Binding to control the animation. You can bind external logic to control the animation status.
115
- /// True to start animation, false to stop animation.
116
- @Binding public var isAnimating: Bool
117
-
118
- /// Create an animated image with url, placeholder, custom options and context.
119
- /// - Parameter url: The image url
120
- /// - Parameter placeholder: The placeholder image to show during loading
121
- /// - Parameter options: The options to use when downloading the image. See `SDWebImageOptions` for the possible values.
122
- /// - Parameter context: A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.
123
- public init(url: URL?, options: SDWebImageOptions = [], context: [SDWebImageContextOption : Any]? = nil) {
124
- self.init(url: url, options: options, context: context, isAnimating: .constant(true))
125
- }
126
-
127
- /// Create an animated image with url, placeholder, custom options and context, including animation control binding.
128
- /// - Parameter url: The image url
129
- /// - Parameter placeholder: The placeholder image to show during loading
130
- /// - Parameter options: The options to use when downloading the image. See `SDWebImageOptions` for the possible values.
131
- /// - Parameter context: A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.
132
- /// - Parameter isAnimating: The binding for animation control
133
- public init(url: URL?, options: SDWebImageOptions = [], context: [SDWebImageContextOption : Any]? = nil, isAnimating: Binding<Bool>) {
134
- let imageModel = AnimatedImageModel()
135
- imageModel.url = url
136
- imageModel.webOptions = options
137
- imageModel.webContext = context
138
- self.init(imageModel: imageModel, isAnimating: isAnimating)
139
- }
140
-
141
- /// Create an animated image with name and bundle.
142
- /// - Note: Asset Catalog is not supported.
143
- /// - Parameter name: The image name
144
- /// - Parameter bundle: The bundle contains image
145
- public init(name: String, bundle: Bundle? = nil) {
146
- self.init(name: name, bundle: bundle, isAnimating: .constant(true))
147
- }
148
-
149
- /// Create an animated image with name and bundle, including animation control binding.
150
- /// - Note: Asset Catalog is not supported.
151
- /// - Parameter name: The image name
152
- /// - Parameter bundle: The bundle contains image
153
- /// - Parameter isAnimating: The binding for animation control
154
- public init(name: String, bundle: Bundle? = nil, isAnimating: Binding<Bool>) {
155
- let imageModel = AnimatedImageModel()
156
- imageModel.name = name
157
- imageModel.bundle = bundle
158
- self.init(imageModel: imageModel, isAnimating: isAnimating)
159
- }
160
-
161
- /// Create an animated image with data and scale.
162
- /// - Parameter data: The image data
163
- /// - Parameter scale: The scale factor
164
- public init(data: Data, scale: CGFloat = 1) {
165
- self.init(data: data, scale: scale, isAnimating: .constant(true))
166
- }
167
-
168
- /// Create an animated image with data and scale, including animation control binding.
169
- /// - Parameter data: The image data
170
- /// - Parameter scale: The scale factor
171
- /// - Parameter isAnimating: The binding for animation control
172
- public init(data: Data, scale: CGFloat = 1, isAnimating: Binding<Bool>) {
173
- let imageModel = AnimatedImageModel()
174
- imageModel.data = data
175
- imageModel.scale = scale
176
- self.init(imageModel: imageModel, isAnimating: isAnimating)
177
- }
178
-
179
- init(imageModel: AnimatedImageModel, isAnimating: Binding<Bool>) {
180
- self._isAnimating = isAnimating
181
- _imageModel = ObservedObject(wrappedValue: imageModel)
182
- }
183
-
184
- #if os(macOS)
185
- public typealias NSViewType = AnimatedImageViewWrapper
186
- #elseif os(iOS) || os(tvOS)
187
- public typealias UIViewType = AnimatedImageViewWrapper
188
- #endif
189
-
190
- public typealias Coordinator = AnimatedImageCoordinator
191
-
192
- public func makeCoordinator() -> Coordinator {
193
- AnimatedImageCoordinator()
194
- }
195
-
196
- #if os(macOS)
197
- public func makeNSView(context: Context) -> AnimatedImageViewWrapper {
198
- makeView(context: context)
199
- }
200
-
201
- public func updateNSView(_ nsView: AnimatedImageViewWrapper, context: Context) {
202
- updateView(nsView, context: context)
203
- }
204
-
205
- public static func dismantleNSView(_ nsView: AnimatedImageViewWrapper, coordinator: Coordinator) {
206
- dismantleView(nsView, coordinator: coordinator)
207
- }
208
- #elseif os(iOS) || os(tvOS)
209
- public func makeUIView(context: Context) -> AnimatedImageViewWrapper {
210
- makeView(context: context)
211
- }
212
-
213
- public func updateUIView(_ uiView: AnimatedImageViewWrapper, context: Context) {
214
- updateView(uiView, context: context)
215
- }
216
-
217
- public static func dismantleUIView(_ uiView: AnimatedImageViewWrapper, coordinator: Coordinator) {
218
- dismantleView(uiView, coordinator: coordinator)
219
- }
220
- #endif
221
-
222
- func setupIndicator(_ view: AnimatedImageViewWrapper, context: Context) {
223
- view.wrapped.sd_imageIndicator = imageConfiguration.indicator
224
- view.wrapped.sd_imageTransition = imageConfiguration.transition
225
- if let placeholderView = imageConfiguration.placeholderView {
226
- placeholderView.removeFromSuperview()
227
- placeholderView.isHidden = true
228
- // Placeholder View should below the Indicator View
229
- if let indicatorView = imageConfiguration.indicator?.indicatorView {
230
- #if os(macOS)
231
- view.wrapped.addSubview(placeholderView, positioned: .below, relativeTo: indicatorView)
232
- #else
233
- view.wrapped.insertSubview(placeholderView, belowSubview: indicatorView)
234
- #endif
235
- } else {
236
- view.wrapped.addSubview(placeholderView)
237
- }
238
- placeholderView.bindFrameToSuperviewBounds()
239
- }
240
- }
241
-
242
- func loadImage(_ view: AnimatedImageViewWrapper, context: Context) {
243
- context.coordinator.imageLoading.isLoading = true
244
- let webOptions = imageModel.webOptions
245
- if webOptions.contains(.delayPlaceholder) {
246
- self.imageConfiguration.placeholderView?.isHidden = true
247
- } else {
248
- self.imageConfiguration.placeholderView?.isHidden = false
249
- }
250
- var webContext = imageModel.webContext ?? [:]
251
- webContext[.animatedImageClass] = SDAnimatedImage.self
252
- view.wrapped.sd_internalSetImage(with: imageModel.url, placeholderImage: imageConfiguration.placeholder, options: webOptions, context: webContext, setImageBlock: nil, progress: { (receivedSize, expectedSize, _) in
253
- let progress: Double
254
- if (expectedSize > 0) {
255
- progress = Double(receivedSize) / Double(expectedSize)
256
- } else {
257
- progress = 0
258
- }
259
- DispatchQueue.main.async {
260
- context.coordinator.imageLoading.progress = progress
261
- }
262
- self.imageHandler.progressBlock?(receivedSize, expectedSize)
263
- }) { (image, data, error, cacheType, finished, _) in
264
- if #available(iOS 14.0, macOS 11.0, watchOS 7.0, tvOS 14.0, *) {
265
- // Do nothing. on iOS 14's SwiftUI, the @Published will always trigger another `updateUIView` call with new UIView instance.
266
- } else {
267
- // This is a hack because of iOS 13's SwiftUI bug, the @Published does not trigger another `updateUIView` call
268
- // Here I have to use UIKit/AppKit API to triger the same effect (the window change implicitly cause re-render)
269
- if let hostingView = view.findHostingView() {
270
- if let _ = hostingView.window {
271
- #if os(macOS)
272
- hostingView.viewDidMoveToWindow()
273
- #else
274
- hostingView.didMoveToWindow()
275
- #endif
276
- }
277
- }
278
- }
279
- context.coordinator.imageLoading.image = image
280
- context.coordinator.imageLoading.isLoading = false
281
- context.coordinator.imageLoading.progress = 1
282
- if let image = image {
283
- self.imageConfiguration.placeholderView?.isHidden = true
284
- self.imageHandler.successBlock?(image, data, cacheType)
285
- } else {
286
- self.imageConfiguration.placeholderView?.isHidden = false
287
- self.imageHandler.failureBlock?(error ?? NSError())
288
- }
289
- }
290
- }
291
-
292
- func makeView(context: Context) -> AnimatedImageViewWrapper {
293
- let view = AnimatedImageViewWrapper()
294
- if let viewCreateBlock = imageHandler.viewCreateBlock {
295
- viewCreateBlock(view.wrapped, context)
296
- }
297
- return view
298
- }
299
-
300
- func updateView(_ view: AnimatedImageViewWrapper, context: Context) {
301
- // Refresh image, imageModel is the Source of Truth, switch the type
302
- // Although we have Source of Truth, we can check the previous value, to avoid re-generate SDAnimatedImage, which is performance-cost.
303
- if let name = imageModel.name, name != context.coordinator.imageLoading.imageName {
304
- #if os(macOS)
305
- let image = SDAnimatedImage(named: name, in: imageModel.bundle)
306
- #else
307
- let image = SDAnimatedImage(named: name, in: imageModel.bundle, compatibleWith: nil)
308
- #endif
309
- context.coordinator.imageLoading.imageName = name
310
- view.wrapped.image = image
311
- } else if let data = imageModel.data, data != context.coordinator.imageLoading.imageData {
312
- let image = SDAnimatedImage(data: data, scale: imageModel.scale)
313
- context.coordinator.imageLoading.imageData = data
314
- view.wrapped.image = image
315
- } else if let url = imageModel.url {
316
- // Determine if image already been loaded and URL is match
317
- var shouldLoad: Bool
318
- if url != context.coordinator.imageLoading.imageURL {
319
- // Change the URL, need new loading
320
- shouldLoad = true
321
- context.coordinator.imageLoading.imageURL = url
322
- } else {
323
- // Same URL, check if already loaded
324
- if context.coordinator.imageLoading.isLoading {
325
- shouldLoad = false
326
- } else if let image = context.coordinator.imageLoading.image {
327
- shouldLoad = false
328
- view.wrapped.image = image
329
- } else {
330
- shouldLoad = true
331
- }
332
- }
333
- if shouldLoad {
334
- setupIndicator(view, context: context)
335
- loadImage(view, context: context)
336
- }
337
- }
338
-
339
- #if os(macOS)
340
- if self.isAnimating != view.wrapped.animates {
341
- view.wrapped.animates = self.isAnimating
342
- }
343
- #else
344
- if self.isAnimating != view.wrapped.isAnimating {
345
- if self.isAnimating {
346
- view.wrapped.startAnimating()
347
- } else {
348
- view.wrapped.stopAnimating()
349
- }
350
- }
351
- #endif
352
-
353
- configureView(view, context: context)
354
- layoutView(view, context: context)
355
- if let viewUpdateBlock = imageHandler.viewUpdateBlock {
356
- viewUpdateBlock(view.wrapped, context)
357
- }
358
- }
359
-
360
- static func dismantleView(_ view: AnimatedImageViewWrapper, coordinator: Coordinator) {
361
- view.wrapped.sd_cancelCurrentImageLoad()
362
- #if os(macOS)
363
- view.wrapped.animates = false
364
- #else
365
- view.wrapped.stopAnimating()
366
- #endif
367
- if let viewDestroyBlock = viewDestroyBlock {
368
- viewDestroyBlock(view.wrapped, coordinator)
369
- }
370
- }
371
-
372
- func layoutView(_ view: AnimatedImageViewWrapper, context: Context) {
373
- // AspectRatio && ContentMode
374
- #if os(macOS)
375
- let contentMode: NSImageScaling
376
- #elseif os(iOS) || os(tvOS)
377
- let contentMode: UIView.ContentMode
378
- #endif
379
- if let _ = imageLayout.aspectRatio {
380
- // If `aspectRatio` is not `nil`, always scale to fill and SwiftUI will layout the container with custom aspect ratio.
381
- #if os(macOS)
382
- contentMode = .scaleAxesIndependently
383
- #elseif os(iOS) || os(tvOS)
384
- contentMode = .scaleToFill
385
- #endif
386
- } else {
387
- // If `aspectRatio` is `nil`, the resulting view maintains this view's aspect ratio.
388
- switch imageLayout.contentMode {
389
- case .fill:
390
- #if os(macOS)
391
- // Actually, NSImageView have no `.aspectFill` unlike UIImageView, only `CALayerContentsGravity.resizeAspectFill` have the same concept
392
- // However, using `.scaleProportionallyUpOrDown`, SwiftUI still layout the HostingView correctly, so this is OK
393
- contentMode = .scaleProportionallyUpOrDown
394
- #elseif os(iOS) || os(tvOS)
395
- contentMode = .scaleAspectFill
396
- #endif
397
- case .fit:
398
- #if os(macOS)
399
- contentMode = .scaleProportionallyUpOrDown
400
- #elseif os(iOS) || os(tvOS)
401
- contentMode = .scaleAspectFit
402
- #endif
403
- case .none:
404
- // If `contentMode` is not set at all, using scale to fill as SwiftUI default value
405
- #if os(macOS)
406
- contentMode = .scaleAxesIndependently
407
- #elseif os(iOS) || os(tvOS)
408
- contentMode = .scaleToFill
409
- #endif
410
- }
411
- }
412
-
413
- #if os(macOS)
414
- view.wrapped.imageScaling = contentMode
415
- #else
416
- view.wrapped.contentMode = contentMode
417
- #endif
418
-
419
- // Resizable
420
- if let _ = imageLayout.resizingMode {
421
- view.resizable = true
422
- }
423
-
424
- // Animated Image does not support resizing mode and rendering mode
425
- if let image = view.wrapped.image, !image.conforms(to: SDAnimatedImageProtocol.self) {
426
- var image = image
427
- // ResizingMode
428
- if let resizingMode = imageLayout.resizingMode, imageLayout.capInsets != EdgeInsets() {
429
- #if os(macOS)
430
- let capInsets = NSEdgeInsets(top: imageLayout.capInsets.top, left: imageLayout.capInsets.leading, bottom: imageLayout.capInsets.bottom, right: imageLayout.capInsets.trailing)
431
- #else
432
- let capInsets = UIEdgeInsets(top: imageLayout.capInsets.top, left: imageLayout.capInsets.leading, bottom: imageLayout.capInsets.bottom, right: imageLayout.capInsets.trailing)
433
- #endif
434
- switch resizingMode {
435
- case .stretch:
436
- #if os(macOS)
437
- image.resizingMode = .stretch
438
- image.capInsets = capInsets
439
- #else
440
- image = image.resizableImage(withCapInsets: capInsets, resizingMode: .stretch)
441
- #endif
442
- view.wrapped.image = image
443
- case .tile:
444
- #if os(macOS)
445
- image.resizingMode = .tile
446
- image.capInsets = capInsets
447
- #else
448
- image = image.resizableImage(withCapInsets: capInsets, resizingMode: .tile)
449
- #endif
450
- view.wrapped.image = image
451
- @unknown default:
452
- // Future cases, not implements
453
- break
454
- }
455
- }
456
-
457
- // RenderingMode
458
- if let renderingMode = imageLayout.renderingMode {
459
- switch renderingMode {
460
- case .template:
461
- #if os(macOS)
462
- image.isTemplate = true
463
- #else
464
- image = image.withRenderingMode(.alwaysTemplate)
465
- #endif
466
- view.wrapped.image = image
467
- case .original:
468
- #if os(macOS)
469
- image.isTemplate = false
470
- #else
471
- image = image.withRenderingMode(.alwaysOriginal)
472
- #endif
473
- view.wrapped.image = image
474
- @unknown default:
475
- // Future cases, not implements
476
- break
477
- }
478
- }
479
- }
480
-
481
- // Interpolation
482
- if let interpolation = imageLayout.interpolation {
483
- switch interpolation {
484
- case .high:
485
- view.interpolationQuality = .high
486
- case .medium:
487
- view.interpolationQuality = .medium
488
- case .low:
489
- view.interpolationQuality = .low
490
- case .none:
491
- view.interpolationQuality = .none
492
- @unknown default:
493
- // Future cases, not implements
494
- break
495
- }
496
- } else {
497
- view.interpolationQuality = .default
498
- }
499
-
500
- // Antialiased
501
- view.shouldAntialias = imageLayout.antialiased
502
-
503
- view.invalidateIntrinsicContentSize()
504
- }
505
-
506
- func configureView(_ view: AnimatedImageViewWrapper, context: Context) {
507
- // IncrementalLoad
508
- if let incrementalLoad = imageConfiguration.incrementalLoad {
509
- view.wrapped.shouldIncrementalLoad = incrementalLoad
510
- } else {
511
- view.wrapped.shouldIncrementalLoad = true
512
- }
513
-
514
- // MaxBufferSize
515
- if let maxBufferSize = imageConfiguration.maxBufferSize {
516
- view.wrapped.maxBufferSize = maxBufferSize
517
- } else {
518
- // automatically
519
- view.wrapped.maxBufferSize = 0
520
- }
521
-
522
- // CustomLoopCount
523
- if let customLoopCount = imageConfiguration.customLoopCount {
524
- view.wrapped.shouldCustomLoopCount = true
525
- view.wrapped.animationRepeatCount = Int(customLoopCount)
526
- } else {
527
- // disable custom loop count
528
- view.wrapped.shouldCustomLoopCount = false
529
- }
530
-
531
- // RunLoop Mode
532
- if let runLoopMode = imageConfiguration.runLoopMode {
533
- view.wrapped.runLoopMode = runLoopMode
534
- } else {
535
- view.wrapped.runLoopMode = .common
536
- }
537
-
538
- // Pausable
539
- if let pausable = imageConfiguration.pausable {
540
- view.wrapped.resetFrameIndexWhenStopped = !pausable
541
- } else {
542
- view.wrapped.resetFrameIndexWhenStopped = false
543
- }
544
-
545
- // Clear Buffer
546
- if let purgeable = imageConfiguration.purgeable {
547
- view.wrapped.clearBufferWhenStopped = purgeable
548
- } else {
549
- view.wrapped.clearBufferWhenStopped = false
550
- }
551
-
552
- // Playback Rate
553
- if let playbackRate = imageConfiguration.playbackRate {
554
- view.wrapped.playbackRate = playbackRate
555
- } else {
556
- view.wrapped.playbackRate = 1.0
557
- }
558
-
559
- // Playback Mode
560
- if let playbackMode = imageConfiguration.playbackMode {
561
- view.wrapped.playbackMode = playbackMode
562
- } else {
563
- view.wrapped.playbackMode = .normal
564
- }
565
- }
566
- }
567
-
568
- // Layout
569
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
570
- extension AnimatedImage {
571
-
572
- /// Configurate this view's image with the specified cap insets and options.
573
- /// - Warning: Animated Image does not implementes.
574
- /// - Parameter capInsets: The values to use for the cap insets.
575
- /// - Parameter resizingMode: The resizing mode
576
- public func resizable(
577
- capInsets: EdgeInsets = EdgeInsets(),
578
- resizingMode: Image.ResizingMode = .stretch) -> AnimatedImage
579
- {
580
- self.imageLayout.capInsets = capInsets
581
- self.imageLayout.resizingMode = resizingMode
582
- return self
583
- }
584
-
585
- /// Configurate this view's rendering mode.
586
- /// - Warning: Animated Image does not implementes.
587
- /// - Parameter renderingMode: The resizing mode
588
- public func renderingMode(_ renderingMode: Image.TemplateRenderingMode?) -> AnimatedImage {
589
- self.imageLayout.renderingMode = renderingMode
590
- return self
591
- }
592
-
593
- /// Configurate this view's image interpolation quality
594
- /// - Parameter interpolation: The interpolation quality
595
- public func interpolation(_ interpolation: Image.Interpolation) -> AnimatedImage {
596
- self.imageLayout.interpolation = interpolation
597
- return self
598
- }
599
-
600
- /// Configurate this view's image antialiasing
601
- /// - Parameter isAntialiased: Whether or not to allow antialiasing
602
- public func antialiased(_ isAntialiased: Bool) -> AnimatedImage {
603
- self.imageLayout.antialiased = isAntialiased
604
- return self
605
- }
606
- }
607
-
608
- // Aspect Ratio
609
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
610
- extension AnimatedImage {
611
- /// Constrains this view's dimensions to the specified aspect ratio.
612
- /// - Parameters:
613
- /// - aspectRatio: The ratio of width to height to use for the resulting
614
- /// view. If `aspectRatio` is `nil`, the resulting view maintains this
615
- /// view's aspect ratio.
616
- /// - contentMode: A flag indicating whether this view should fit or
617
- /// fill the parent context.
618
- /// - Returns: A view that constrains this view's dimensions to
619
- /// `aspectRatio`, using `contentMode` as its scaling algorithm.
620
- public func aspectRatio(_ aspectRatio: CGFloat? = nil, contentMode: ContentMode) -> some View {
621
- // The `SwifUI.View.aspectRatio(_:contentMode:)` says:
622
- // If `aspectRatio` is `nil`, the resulting view maintains this view's aspect ratio
623
- // But 1: there are no public API to declare what `this view's aspect ratio` is
624
- // So, if we don't override this method, SwiftUI ignore the content mode on actual ImageView
625
- // To workaround, we want to call the default `SwifUI.View.aspectRatio(_:contentMode:)` method
626
- // But 2: there are no way to call a Protocol Extention default implementation in Swift 5.1
627
- // So, we directly call the implementation detail modifier instead
628
- // Fired Radar: FB7413534
629
- self.imageLayout.aspectRatio = aspectRatio
630
- self.imageLayout.contentMode = contentMode
631
- return self.modifier(_AspectRatioLayout(aspectRatio: aspectRatio, contentMode: contentMode))
632
- }
633
-
634
- /// Constrains this view's dimensions to the aspect ratio of the given size.
635
- /// - Parameters:
636
- /// - aspectRatio: A size specifying the ratio of width to height to use
637
- /// for the resulting view.
638
- /// - contentMode: A flag indicating whether this view should fit or
639
- /// fill the parent context.
640
- /// - Returns: A view that constrains this view's dimensions to
641
- /// `aspectRatio`, using `contentMode` as its scaling algorithm.
642
- public func aspectRatio(_ aspectRatio: CGSize, contentMode: ContentMode) -> some View {
643
- return self.aspectRatio(aspectRatio.width / aspectRatio.height, contentMode: contentMode)
644
- }
645
-
646
- /// Scales this view to fit its parent.
647
- /// - Returns: A view that scales this view to fit its parent,
648
- /// maintaining this view's aspect ratio.
649
- public func scaledToFit() -> some View {
650
- return self.aspectRatio(nil, contentMode: .fit)
651
- }
652
-
653
- /// Scales this view to fill its parent.
654
- /// - Returns: A view that scales this view to fit its parent,
655
- /// maintaining this view's aspect ratio.
656
- public func scaledToFill() -> some View {
657
- return self.aspectRatio(nil, contentMode: .fill)
658
- }
659
- }
660
-
661
- // AnimatedImage Modifier
662
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
663
- extension AnimatedImage {
664
-
665
- /// Total loop count for animated image rendering. Defaults to nil.
666
- /// - Note: Pass nil to disable customization, use the image itself loop count (`animatedImageLoopCount`) instead
667
- /// - Parameter loopCount: The animation loop count
668
- public func customLoopCount(_ loopCount: UInt?) -> AnimatedImage {
669
- self.imageConfiguration.customLoopCount = loopCount
670
- return self
671
- }
672
-
673
- /// Provide a max buffer size by bytes. This is used to adjust frame buffer count and can be useful when the decoding cost is expensive (such as Animated WebP software decoding). Default is nil.
674
- ///
675
- /// `0` or nil means automatically adjust by calculating current memory usage.
676
- /// `1` means without any buffer cache, each of frames will be decoded and then be freed after rendering. (Lowest Memory and Highest CPU)
677
- /// `UInt.max` means cache all the buffer. (Lowest CPU and Highest Memory)
678
- /// - Parameter bufferSize: The max buffer size
679
- public func maxBufferSize(_ bufferSize: UInt?) -> AnimatedImage {
680
- self.imageConfiguration.maxBufferSize = bufferSize
681
- return self
682
- }
683
-
684
- /// Whehter or not to enable incremental image load for animated image. See `SDAnimatedImageView` for detailed explanation for this.
685
- /// - Note: If you are confused about this description, open Chrome browser to view some large GIF images with low network speed to see the animation behavior.
686
- /// Default is true. Set to false to only render the static poster for incremental animated image.
687
- /// - Parameter incrementalLoad: Whether or not to incremental load
688
- public func incrementalLoad(_ incrementalLoad: Bool) -> AnimatedImage {
689
- self.imageConfiguration.incrementalLoad = incrementalLoad
690
- return self
691
- }
692
-
693
- /// The runLoopMode when animation is playing on. Defaults is `.common`
694
- /// You can specify a runloop mode to let it rendering.
695
- /// - Note: This is useful for some cases, for example, always specify NSDefaultRunLoopMode, if you want to pause the animation when user scroll (for Mac user, drag the mouse or touchpad)
696
- /// - Parameter runLoopMode: The runLoopMode for animation
697
- public func runLoopMode(_ runLoopMode: RunLoop.Mode) -> AnimatedImage {
698
- self.imageConfiguration.runLoopMode = runLoopMode
699
- return self
700
- }
701
-
702
- /// Whether or not to pause the animation (keep current frame), instead of stop the animation (frame index reset to 0). When `isAnimating` binding value changed to false. Defaults is true.
703
- /// - Note: For some of use case, you may want to reset the frame index to 0 when stop, but some other want to keep the current frame index.
704
- /// - Parameter pausable: Whether or not to pause the animation instead of stop the animation.
705
- public func pausable(_ pausable: Bool) -> AnimatedImage {
706
- self.imageConfiguration.pausable = pausable
707
- return self
708
- }
709
-
710
- /// Whether or not to clear frame buffer cache when stopped. Defaults is false.
711
- /// Note: This is useful when you want to limit the memory usage during frequently visibility changes (such as image view inside a list view, then push and pop)
712
- /// - Parameter purgeable: Whether or not to clear frame buffer cache when stopped.
713
- public func purgeable(_ purgeable: Bool) -> AnimatedImage {
714
- self.imageConfiguration.purgeable = purgeable
715
- return self
716
- }
717
-
718
- /// Control the animation playback rate. Default is 1.0.
719
- /// `1.0` means the normal speed.
720
- /// `0.0` means stopping the animation.
721
- /// `0.0-1.0` means the slow speed.
722
- /// `> 1.0` means the fast speed.
723
- /// `< 0.0` is not supported currently and stop animation. (may support reverse playback in the future)
724
- /// - Parameter playbackRate: The animation playback rate.
725
- public func playbackRate(_ playbackRate: Double) -> AnimatedImage {
726
- self.imageConfiguration.playbackRate = playbackRate
727
- return self
728
- }
729
-
730
- /// Control the animation playback mode. Default is .normal
731
- /// - Parameter playbackMode: The playback mode, including normal order, reverse order, bounce order and reversed bounce order.
732
- public func playbackMode(_ playbackMode: SDAnimatedImagePlaybackMode) -> AnimatedImage {
733
- self.imageConfiguration.playbackMode = playbackMode
734
- return self
735
- }
736
- }
737
-
738
- // Completion Handler
739
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
740
- extension AnimatedImage {
741
-
742
- /// Provide the action when image load fails.
743
- /// - Parameters:
744
- /// - action: The action to perform. The first arg is the error during loading. If `action` is `nil`, the call has no effect.
745
- /// - Returns: A view that triggers `action` when this image load fails.
746
- public func onFailure(perform action: ((Error) -> Void)? = nil) -> AnimatedImage {
747
- self.imageHandler.failureBlock = action
748
- return self
749
- }
750
-
751
- /// Provide the action when image load successes.
752
- /// - Parameters:
753
- /// - action: The action to perform. The first arg is the loaded image, the second arg is the loaded image data, the third arg is the cache type loaded from. If `action` is `nil`, the call has no effect.
754
- /// - Returns: A view that triggers `action` when this image load successes.
755
- public func onSuccess(perform action: ((PlatformImage, Data?, SDImageCacheType) -> Void)? = nil) -> AnimatedImage {
756
- self.imageHandler.successBlock = action
757
- return self
758
- }
759
-
760
- /// Provide the action when image load progress changes.
761
- /// - Parameters:
762
- /// - action: The action to perform. The first arg is the received size, the second arg is the total size, all in bytes. If `action` is `nil`, the call has no effect.
763
- /// - Returns: A view that triggers `action` when this image load successes.
764
- public func onProgress(perform action: ((Int, Int) -> Void)? = nil) -> AnimatedImage {
765
- self.imageHandler.progressBlock = action
766
- return self
767
- }
768
- }
769
-
770
- // View Coordinator Handler
771
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
772
- extension AnimatedImage {
773
-
774
- /// Provide the action when view representable create the native view.
775
- /// - Parameter action: The action to perform. The first arg is the native view. The seconds arg is the context.
776
- /// - Returns: A view that triggers `action` when view representable create the native view.
777
- public func onViewCreate(perform action: ((PlatformView, Context) -> Void)? = nil) -> AnimatedImage {
778
- self.imageHandler.viewCreateBlock = action
779
- return self
780
- }
781
-
782
- /// Provide the action when view representable update the native view.
783
- /// - Parameter action: The action to perform. The first arg is the native view. The seconds arg is the context.
784
- /// - Returns: A view that triggers `action` when view representable update the native view.
785
- public func onViewUpdate(perform action: ((PlatformView, Context) -> Void)? = nil) -> AnimatedImage {
786
- self.imageHandler.viewUpdateBlock = action
787
- return self
788
- }
789
-
790
- /// Provide the action when view representable destroy the native view
791
- /// - Parameter action: The action to perform. The first arg is the native view. The seconds arg is the coordinator (with userInfo).
792
- /// - Returns: A view that triggers `action` when view representable destroy the native view.
793
- public static func onViewDestroy(perform action: ((PlatformView, Coordinator) -> Void)? = nil) {
794
- self.viewDestroyBlock = action
795
- }
796
- }
797
-
798
- // Web Image convenience, based on UIKit/AppKit API
799
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
800
- extension AnimatedImage {
801
-
802
- /// Associate a placeholder when loading image with url
803
- /// - Parameter content: A view that describes the placeholder.
804
- /// - note: The differences between this and placeholder image, it's that placeholder image replace the image for image view, but this modify the View Hierarchy to overlay the placeholder hosting view
805
- public func placeholder<T>(@ViewBuilder content: () -> T) -> AnimatedImage where T : View {
806
- #if os(macOS)
807
- let hostingView = NSHostingView(rootView: content())
808
- #else
809
- let hostingView = _UIHostingView(rootView: content())
810
- #endif
811
- self.imageConfiguration.placeholderView = hostingView
812
- return self
813
- }
814
-
815
- /// Associate a placeholder image when loading image with url
816
- /// - Parameter content: A view that describes the placeholder.
817
- public func placeholder(_ image: PlatformImage?) -> AnimatedImage {
818
- self.imageConfiguration.placeholder = image
819
- return self
820
- }
821
-
822
- /// Associate a indicator when loading image with url
823
- /// - Note: If you do not need indicator, specify nil. Defaults to nil
824
- /// - Parameter indicator: indicator, see more in `SDWebImageIndicator`
825
- public func indicator(_ indicator: SDWebImageIndicator?) -> AnimatedImage {
826
- self.imageConfiguration.indicator = indicator
827
- return self
828
- }
829
-
830
- /// Associate a transition when loading image with url
831
- /// - Note: If you specify nil, do not do transition. Defautls to nil.
832
- /// - Parameter transition: transition, see more in `SDWebImageTransition`
833
- public func transition(_ transition: SDWebImageTransition?) -> AnimatedImage {
834
- self.imageConfiguration.transition = transition
835
- return self
836
- }
837
- }
838
-
839
- // Indicator
840
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
841
- extension AnimatedImage {
842
-
843
- /// Associate a indicator when loading image with url
844
- /// - Parameter indicator: The indicator type, see `Indicator`
845
- public func indicator<T>(_ indicator: Indicator<T>) -> some View where T : View {
846
- return self.modifier(IndicatorViewModifier(status: indicatorStatus, indicator: indicator))
847
- }
848
-
849
- /// Associate a indicator when loading image with url, convenient method with block
850
- /// - Parameter content: A view that describes the indicator.
851
- public func indicator<T>(@ViewBuilder content: @escaping (_ isAnimating: Binding<Bool>, _ progress: Binding<Double>) -> T) -> some View where T : View {
852
- return indicator(Indicator(content: content))
853
- }
854
- }
855
-
856
- #if DEBUG
857
- @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
858
- struct AnimatedImage_Previews : PreviewProvider {
859
- static var previews: some View {
860
- Group {
861
- AnimatedImage(url: URL(string: "http://assets.sbnation.com/assets/2512203/dogflops.gif"))
862
- .resizable()
863
- .aspectRatio(contentMode: .fit)
864
- .padding()
865
- }
866
- }
867
- }
868
- #endif
869
-
870
- #endif