@momo-kits/native-kits 0.0.1-beta.3 → 0.0.1-beta.5
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/example/ios/Example/ComponentModel.swift +9 -2
- package/example/ios/Example/ContentView.swift +0 -14
- package/example/ios/Example/Foundation/ImageDemo.swift +43 -0
- package/example/ios/Example/Foundation/Popup/Popups.swift +2 -52
- package/example/ios/Example/Foundation/PopupDemo.swift +44 -21
- package/example/ios/Example/Foundation/TextInputDemo.swift +36 -0
- package/example/ios/Example/Library/CheckboxDemo.swift +19 -0
- package/example/ios/Example/Library/SwitchDemo.swift +19 -0
- package/example/ios/Example/Main.swift +17 -1
- package/example/ios/Example/Resource/foundation.json +2 -2
- package/example/ios/Example/Resource/library.json +10 -0
- package/example/ios/Example.xcodeproj/project.pbxproj +16 -0
- package/example/ios/Example.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +1 -1
- package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Podfile +2 -1
- package/example/ios/Podfile.lock +22 -3
- package/example/ios/Pods/Local Podspecs/MoMoUIKits.podspec.json +9 -1
- package/example/ios/Pods/Manifest.lock +22 -3
- package/example/ios/Pods/Pods.xcodeproj/project.pbxproj +1547 -161
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/SDWebImage.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/SkeletonUI.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +21 -0
- package/example/ios/Pods/SDWebImage/LICENSE +20 -0
- package/example/ios/Pods/SDWebImage/README.md +352 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.h +340 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.m +172 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.h +63 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.m +165 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.h +67 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.m +120 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.h +114 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.m +392 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.h +112 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.m +420 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.h +23 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.m +133 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.h +168 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.m +79 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.h +110 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.m +540 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.h +145 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m +326 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.h +73 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.m +256 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.h +19 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.m +58 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.h +23 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.m +98 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCache.h +450 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCache.m +1030 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.h +153 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.m +68 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.h +156 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.m +138 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.h +81 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.m +556 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.h +297 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.m +26 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.h +153 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.m +822 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.h +58 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.m +130 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.h +36 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.m +28 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.h +22 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.m +58 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.h +28 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.m +127 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.h +25 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.m +101 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.h +58 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.m +807 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.h +30 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.m +420 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.h +146 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.m +170 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.h +40 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.m +123 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.h +241 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.m +331 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.h +78 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.m +158 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.h +32 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.m +39 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.h +36 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.m +39 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.h +95 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.m +17 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.h +352 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.m +149 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.h +314 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.m +658 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.h +113 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.m +60 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.h +49 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.m +55 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.h +191 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.m +722 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h +69 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.m +71 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h +69 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m +73 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.h +32 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.m +16 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.h +115 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.m +275 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.h +290 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.m +775 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.h +27 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.m +14 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.h +72 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.m +59 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.h +143 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.m +303 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.h +131 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.m +194 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.h +387 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.m +234 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.h +24 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.m +23 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.h +46 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.m +60 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.h +26 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.m +22 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.h +27 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.m +47 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.h +89 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.m +221 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.h +80 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.m +47 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.h +146 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.m +824 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.h +129 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.m +76 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.h +194 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.m +67 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.h +110 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.m +446 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.h +48 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.m +82 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h +24 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.m +42 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.h +14 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.m +29 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.h +21 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.m +92 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.h +18 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.m +32 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.h +29 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.m +227 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.h +19 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.m +127 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.h +23 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.m +164 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.h +21 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.m +83 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h +39 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.h +122 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.m +13 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.h +20 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.m +79 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDWebImageTransitionInternal.h +19 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDmetamacros.h +667 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.h +18 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.m +42 -0
- package/example/ios/Pods/SDWebImage/WebImage/SDWebImage.h +89 -0
- package/example/ios/Pods/SDWebImageSwiftUI/LICENSE +19 -0
- package/example/ios/Pods/SDWebImageSwiftUI/README.md +690 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/AnimatedImage.swift +870 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/Backport.swift +59 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/OnChange.swift +52 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/Overlay.swift +124 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/StateObject.swift +151 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Image.swift +78 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImageManager.swift +132 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImagePlayer.swift +122 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImageViewWrapper.swift +133 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/ActivityIndicator.swift +82 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/Indicator.swift +97 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/ProgressIndicator.swift +114 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/SDWebImageSwiftUI.swift +64 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/SwiftUICompatibility.swift +92 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Transition/Transition.swift +93 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/WebImage.swift +509 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Module/SDWebImageSwiftUI.h +15 -0
- package/example/ios/Pods/SkeletonUI/LICENSE +21 -0
- package/example/ios/Pods/SkeletonUI/README.md +137 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Angle/AngleInteractor.swift +29 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Angle/AnglePresenter.swift +7 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Animation/AnimationInteractor.swift +56 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Appearance/AppearanceInteractor.swift +58 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Appearance/AppearancePresenter.swift +5 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/ClosedRange+Normalize.swift +16 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Image+OptionalType.swift +102 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/ModifiedContent+SkeletonModifier.swift +26 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Optional+OptionalType.swift +5 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/SecureField+OptionalType.swift +19 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Text+OptionalType.swift +27 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/TextField+OptionalType.swift +35 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Toggle+OptionalType.swift +29 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/UnitPoint+Angle.swift +8 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/View+SkeletonModifier.swift +8 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Modifiers/SkeletonModifier.swift +52 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Multiline/MultilineInteractor.swift +41 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Multiline/MultilinePresenter.swift +9 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Opacity/OpacityInteractor.swift +29 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Opacity/OpacityPresenter.swift +7 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Position/PositionInteractor.swift +29 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Position/PositionPresenter.swift +7 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Protocols/OptionalType.swift +4 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Radius/RadiusInteractor.swift +29 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Radius/RadiusPresenter.swift +7 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Shape/ShapeInteractor.swift +33 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Shape/ShapePresenter.swift +5 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonForEach.swift +20 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonInteractor.swift +27 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonList.swift +20 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonPresenter.swift +15 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonShape.swift +64 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonView.swift +25 -0
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.debug.xcconfig +4 -1
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.release.xcconfig +4 -1
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.markdown +72 -0
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.plist +90 -0
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig +6 -5
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig +6 -5
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m +5 -0
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch +12 -0
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h +75 -0
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage.debug.xcconfig +14 -0
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage.modulemap +6 -0
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage.release.xcconfig +14 -0
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-dummy.m +5 -0
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-prefix.pch +12 -0
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-umbrella.h +17 -0
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.debug.xcconfig +17 -0
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.modulemap +6 -0
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.release.xcconfig +17 -0
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI-dummy.m +5 -0
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI-prefix.pch +12 -0
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI-umbrella.h +16 -0
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI.debug.xcconfig +12 -0
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI.modulemap +6 -0
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI.release.xcconfig +12 -0
- package/ios/Checkbox/Checkbox.swift +38 -0
- package/ios/{Colors+Spacing → Colors+Radius+Spacing}/Colors.swift +0 -0
- package/ios/Colors+Radius+Spacing/Radius.swift +22 -0
- package/ios/{Colors+Spacing → Colors+Radius+Spacing}/Spacing.swift +0 -0
- package/ios/Extensions/View++.swift +9 -0
- package/ios/Image/Image.swift +60 -0
- package/ios/Input/Input.swift +148 -0
- package/ios/OTPKeyboard/OTPKeyboard.swift +3 -3
- package/ios/Popup/PopupDisplay.swift +178 -0
- package/ios/PopupView/FullscreenPopup.swift +251 -0
- package/ios/{Popup → PopupView}/Modifiers.swift +6 -20
- package/ios/{Popup → PopupView}/PopupView.swift +38 -146
- package/ios/PopupView/Utils++.swift +281 -0
- package/ios/Swipeable/SwipeCell.swift +1 -1
- package/ios/Switch/Switch.swift +44 -0
- package/ios/native-kits.podspec +2 -0
- package/package.json +1 -1
- package/ios/Colors+Spacing/Radius.swift +0 -11
- package/ios/Popup/Utils.swift +0 -186
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
import ObjectiveC
|
|
3
|
+
|
|
4
|
+
/// Provides a convenient method for backporting API,
|
|
5
|
+
/// including types, functions, properties, property wrappers and more.
|
|
6
|
+
///
|
|
7
|
+
/// To backport a SwiftUI Label for example, you could apply the
|
|
8
|
+
/// following extension:
|
|
9
|
+
///
|
|
10
|
+
/// extension Backport where Content == Any {
|
|
11
|
+
/// public struct Label<Title, Icon> { }
|
|
12
|
+
/// }
|
|
13
|
+
///
|
|
14
|
+
/// Now if we want to provide further extensions to our backport type,
|
|
15
|
+
/// we need to ensure we retain the `Content == Any` generic requirement:
|
|
16
|
+
///
|
|
17
|
+
/// extension Backport.Label where Content == Any, Title == Text, Icon == Image {
|
|
18
|
+
/// public init<S: StringProtocol>(_ title: S, systemName: String) { }
|
|
19
|
+
/// }
|
|
20
|
+
///
|
|
21
|
+
/// In addition to types, we can also provide backports for properties
|
|
22
|
+
/// and methods:
|
|
23
|
+
///
|
|
24
|
+
/// extension Backport.Label where Content: View {
|
|
25
|
+
/// func onChange<Value: Equatable>(of value: Value, perform action: (Value) -> Void) -> some View {
|
|
26
|
+
/// // `content` provides access to the extended type
|
|
27
|
+
/// content.modifier(OnChangeModifier(value, action))
|
|
28
|
+
/// }
|
|
29
|
+
/// }
|
|
30
|
+
///
|
|
31
|
+
public struct Backport<Wrapped> {
|
|
32
|
+
|
|
33
|
+
/// The underlying content this backport represents.
|
|
34
|
+
public let content: Wrapped
|
|
35
|
+
|
|
36
|
+
/// Initializes a new Backport for the specified content.
|
|
37
|
+
/// - Parameter content: The content (type) that's being backported
|
|
38
|
+
public init(_ content: Wrapped) {
|
|
39
|
+
self.content = content
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public extension View {
|
|
45
|
+
/// Wraps a SwiftUI `View` that can be extended to provide backport functionality.
|
|
46
|
+
var backport: Backport<Self> { .init(self) }
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public extension NSObjectProtocol {
|
|
50
|
+
/// Wraps an `NSObject` that can be extended to provide backport functionality.
|
|
51
|
+
var backport: Backport<Self> { .init(self) }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public extension AnyTransition {
|
|
55
|
+
/// Wraps an `AnyTransition` that can be extended to provide backport functionality.
|
|
56
|
+
static var backport: Backport<AnyTransition>{
|
|
57
|
+
Backport(.identity)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
import Combine
|
|
3
|
+
|
|
4
|
+
@available(iOS, deprecated: 14.0)
|
|
5
|
+
@available(macOS, deprecated: 11.0)
|
|
6
|
+
@available(tvOS, deprecated: 14.0)
|
|
7
|
+
@available(watchOS, deprecated: 7.0)
|
|
8
|
+
public extension Backport where Wrapped: View {
|
|
9
|
+
|
|
10
|
+
/// Adds a modifier for this view that fires an action when a specific
|
|
11
|
+
/// value changes.
|
|
12
|
+
///
|
|
13
|
+
/// `onChange` is called on the main thread. Avoid performing long-running
|
|
14
|
+
/// tasks on the main thread. If you need to perform a long-running task in
|
|
15
|
+
/// response to `value` changing, you should dispatch to a background queue.
|
|
16
|
+
///
|
|
17
|
+
/// The new value is passed into the closure.
|
|
18
|
+
///
|
|
19
|
+
/// - Parameters:
|
|
20
|
+
/// - value: The value to observe for changes
|
|
21
|
+
/// - action: A closure to run when the value changes.
|
|
22
|
+
/// - newValue: The new value that changed
|
|
23
|
+
///
|
|
24
|
+
/// - Returns: A view that fires an action when the specified value changes.
|
|
25
|
+
@ViewBuilder
|
|
26
|
+
func onChange<Value: Equatable>(of value: Value, perform action: @escaping (Value) -> Void) -> some View {
|
|
27
|
+
content.modifier(ChangeModifier(value: value, action: action))
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private struct ChangeModifier<Value: Equatable>: ViewModifier {
|
|
33
|
+
let value: Value
|
|
34
|
+
let action: (Value) -> Void
|
|
35
|
+
|
|
36
|
+
@State var oldValue: Value?
|
|
37
|
+
|
|
38
|
+
init(value: Value, action: @escaping (Value) -> Void) {
|
|
39
|
+
self.value = value
|
|
40
|
+
self.action = action
|
|
41
|
+
_oldValue = .init(initialValue: value)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
func body(content: Content) -> some View {
|
|
45
|
+
content
|
|
46
|
+
.onReceive(Just(value)) { newValue in
|
|
47
|
+
guard newValue != oldValue else { return }
|
|
48
|
+
action(newValue)
|
|
49
|
+
oldValue = newValue
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
|
|
3
|
+
public extension Backport where Wrapped: View {
|
|
4
|
+
|
|
5
|
+
/// Layers the views that you specify in front of this view.
|
|
6
|
+
///
|
|
7
|
+
/// Use this modifier to place one or more views in front of another view.
|
|
8
|
+
/// For example, you can place a group of stars on a ``RoundedRectangle``:
|
|
9
|
+
///
|
|
10
|
+
/// RoundedRectangle(cornerRadius: 8)
|
|
11
|
+
/// .frame(width: 200, height: 100)
|
|
12
|
+
/// .overlay(alignment: .topLeading) { Star(color: .red) }
|
|
13
|
+
/// .overlay(alignment: .topTrailing) { Star(color: .yellow) }
|
|
14
|
+
/// .overlay(alignment: .bottomLeading) { Star(color: .green) }
|
|
15
|
+
/// .overlay(alignment: .bottomTrailing) { Star(color: .blue) }
|
|
16
|
+
///
|
|
17
|
+
/// The example above assumes that you've defined a `Star` view with a
|
|
18
|
+
/// parameterized color:
|
|
19
|
+
///
|
|
20
|
+
/// struct Star: View {
|
|
21
|
+
/// var color = Color.yellow
|
|
22
|
+
///
|
|
23
|
+
/// var body: some View {
|
|
24
|
+
/// Image(systemName: "star.fill")
|
|
25
|
+
/// .foregroundStyle(color)
|
|
26
|
+
/// }
|
|
27
|
+
/// }
|
|
28
|
+
///
|
|
29
|
+
/// By setting different `alignment` values for each modifier, you make the
|
|
30
|
+
/// stars appear in different places on the rectangle:
|
|
31
|
+
///
|
|
32
|
+
/// 
|
|
36
|
+
///
|
|
37
|
+
/// If you specify more than one view in the `content` closure, the modifier
|
|
38
|
+
/// collects all of the views in the closure into an implicit ``ZStack``,
|
|
39
|
+
/// taking them in order from back to front. For example, you can place a
|
|
40
|
+
/// star and a ``Circle`` on a field of ``ShapeStyle/blue``:
|
|
41
|
+
///
|
|
42
|
+
/// Color.blue
|
|
43
|
+
/// .frame(width: 200, height: 200)
|
|
44
|
+
/// .overlay {
|
|
45
|
+
/// Circle()
|
|
46
|
+
/// .frame(width: 100, height: 100)
|
|
47
|
+
/// Star()
|
|
48
|
+
/// }
|
|
49
|
+
///
|
|
50
|
+
/// Both the overlay modifier and the implicit ``ZStack`` composed from the
|
|
51
|
+
/// overlay content --- the circle and the star --- use a default
|
|
52
|
+
/// ``Alignment/center`` alignment. The star appears centered on the circle,
|
|
53
|
+
/// and both appear as a composite view centered in front of the square:
|
|
54
|
+
///
|
|
55
|
+
/// 
|
|
57
|
+
///
|
|
58
|
+
/// If you specify an alignment for the overlay, it applies to the implicit
|
|
59
|
+
/// stack rather than to the individual views in the closure. You can see
|
|
60
|
+
/// this if you add the ``Alignment/bottom`` alignment:
|
|
61
|
+
///
|
|
62
|
+
/// Color.blue
|
|
63
|
+
/// .frame(width: 200, height: 200)
|
|
64
|
+
/// .overlay(alignment: .bottom) {
|
|
65
|
+
/// Circle()
|
|
66
|
+
/// .frame(width: 100, height: 100)
|
|
67
|
+
/// Star()
|
|
68
|
+
/// }
|
|
69
|
+
///
|
|
70
|
+
/// The circle and the star move down as a unit to align the stack's bottom
|
|
71
|
+
/// edge with the bottom edge of the square, while the star remains
|
|
72
|
+
/// centered on the circle:
|
|
73
|
+
///
|
|
74
|
+
/// 
|
|
77
|
+
///
|
|
78
|
+
/// To control the placement of individual items inside the `content`
|
|
79
|
+
/// closure, either use a different overlay modifier for each item, as the
|
|
80
|
+
/// earlier example of stars in the corners of a rectangle demonstrates, or
|
|
81
|
+
/// add an explicit ``ZStack`` inside the content closure with its own
|
|
82
|
+
/// alignment:
|
|
83
|
+
///
|
|
84
|
+
/// Color.blue
|
|
85
|
+
/// .frame(width: 200, height: 200)
|
|
86
|
+
/// .overlay(alignment: .bottom) {
|
|
87
|
+
/// ZStack(alignment: .bottom) {
|
|
88
|
+
/// Circle()
|
|
89
|
+
/// .frame(width: 100, height: 100)
|
|
90
|
+
/// Star()
|
|
91
|
+
/// }
|
|
92
|
+
/// }
|
|
93
|
+
///
|
|
94
|
+
/// The stack alignment ensures that the star's bottom edge aligns with the
|
|
95
|
+
/// circle's, while the overlay aligns the composite view with the square:
|
|
96
|
+
///
|
|
97
|
+
/// 
|
|
99
|
+
///
|
|
100
|
+
/// You can achieve layering without an overlay modifier by putting both the
|
|
101
|
+
/// modified view and the overlay content into a ``ZStack``. This can
|
|
102
|
+
/// produce a simpler view hierarchy, but changes the layout priority that
|
|
103
|
+
/// SwiftUI applies to the views. Use the overlay modifier when you want the
|
|
104
|
+
/// modified view to dominate the layout.
|
|
105
|
+
///
|
|
106
|
+
/// If you want to specify a ``ShapeStyle`` like a ``Color`` or a
|
|
107
|
+
/// ``Material`` as the overlay, use
|
|
108
|
+
/// ``View/overlay(_:ignoresSafeAreaEdges:)`` instead. To specify a
|
|
109
|
+
/// ``Shape``, use ``View/overlay(_:in:fillStyle:)``.
|
|
110
|
+
///
|
|
111
|
+
/// - Parameters:
|
|
112
|
+
/// - alignment: The alignment that the modifier uses to position the
|
|
113
|
+
/// implicit ``ZStack`` that groups the foreground views. The default
|
|
114
|
+
/// is ``Alignment/center``.
|
|
115
|
+
/// - content: A ``ViewBuilder`` that you use to declare the views to
|
|
116
|
+
/// draw in front of this view, stacked in the order that you list them.
|
|
117
|
+
/// The last view that you list appears at the front of the stack.
|
|
118
|
+
///
|
|
119
|
+
/// - Returns: A view that uses the specified content as a foreground.
|
|
120
|
+
func overlay<Content: View>(alignment: Alignment = .center, @ViewBuilder _ content: () -> Content) -> some View {
|
|
121
|
+
self.content.overlay(content(), alignment: alignment)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
}
|
package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/StateObject.swift
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import Combine
|
|
2
|
+
import SwiftUI
|
|
3
|
+
|
|
4
|
+
@available(iOS, deprecated: 14.0)
|
|
5
|
+
@available(macOS, deprecated: 11.0)
|
|
6
|
+
@available(tvOS, deprecated: 14.0)
|
|
7
|
+
@available(watchOS, deprecated: 7.0)
|
|
8
|
+
public extension Backport where Wrapped: ObservableObject {
|
|
9
|
+
|
|
10
|
+
/// A property wrapper type that instantiates an observable object.
|
|
11
|
+
///
|
|
12
|
+
/// Create a state object in a ``SwiftUI/View``, ``SwiftUI/App``, or
|
|
13
|
+
/// ``SwiftUI/Scene`` by applying the `@Backport.StateObject` attribute to a property
|
|
14
|
+
/// declaration and providing an initial value that conforms to the
|
|
15
|
+
/// <doc://com.apple.documentation/documentation/Combine/ObservableObject>
|
|
16
|
+
/// protocol:
|
|
17
|
+
///
|
|
18
|
+
/// @Backport.StateObject var model = DataModel()
|
|
19
|
+
///
|
|
20
|
+
/// SwiftUI creates a new instance of the object only once for each instance of
|
|
21
|
+
/// the structure that declares the object. When published properties of the
|
|
22
|
+
/// observable object change, SwiftUI updates the parts of any view that depend
|
|
23
|
+
/// on those properties:
|
|
24
|
+
///
|
|
25
|
+
/// Text(model.title) // Updates the view any time `title` changes.
|
|
26
|
+
///
|
|
27
|
+
/// You can pass the state object into a property that has the
|
|
28
|
+
/// ``SwiftUI/ObservedObject`` attribute. You can alternatively add the object
|
|
29
|
+
/// to the environment of a view hierarchy by applying the
|
|
30
|
+
/// ``SwiftUI/View/environmentObject(_:)`` modifier:
|
|
31
|
+
///
|
|
32
|
+
/// ContentView()
|
|
33
|
+
/// .environmentObject(model)
|
|
34
|
+
///
|
|
35
|
+
/// If you create an environment object as shown in the code above, you can
|
|
36
|
+
/// read the object inside `ContentView` or any of its descendants
|
|
37
|
+
/// using the ``SwiftUI/EnvironmentObject`` attribute:
|
|
38
|
+
///
|
|
39
|
+
/// @EnvironmentObject var model: DataModel
|
|
40
|
+
///
|
|
41
|
+
/// Get a ``SwiftUI/Binding`` to one of the state object's properties using the
|
|
42
|
+
/// `$` operator. Use a binding when you want to create a two-way connection to
|
|
43
|
+
/// one of the object's properties. For example, you can let a
|
|
44
|
+
/// ``SwiftUI/Toggle`` control a Boolean value called `isEnabled` stored in the
|
|
45
|
+
/// model:
|
|
46
|
+
///
|
|
47
|
+
/// Toggle("Enabled", isOn: $model.isEnabled)
|
|
48
|
+
@propertyWrapper struct StateObject: DynamicProperty {
|
|
49
|
+
private final class Wrapper: ObservableObject {
|
|
50
|
+
private var subject = PassthroughSubject<Void, Never>()
|
|
51
|
+
|
|
52
|
+
var value: Wrapped? {
|
|
53
|
+
didSet {
|
|
54
|
+
cancellable = nil
|
|
55
|
+
cancellable = value?.objectWillChange
|
|
56
|
+
.sink { [subject] _ in subject.send() }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private var cancellable: AnyCancellable?
|
|
61
|
+
|
|
62
|
+
var objectWillChange: AnyPublisher<Void, Never> {
|
|
63
|
+
subject.eraseToAnyPublisher()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@State private var state = Wrapper()
|
|
68
|
+
|
|
69
|
+
@ObservedObject private var observedObject = Wrapper()
|
|
70
|
+
|
|
71
|
+
private var thunk: () -> Wrapped
|
|
72
|
+
|
|
73
|
+
/// The underlying value referenced by the state object.
|
|
74
|
+
///
|
|
75
|
+
/// The wrapped value property provides primary access to the value's data.
|
|
76
|
+
/// However, you don't access `wrappedValue` directly. Instead, use the
|
|
77
|
+
/// property variable created with the `@Backport.StateObject` attribute:
|
|
78
|
+
///
|
|
79
|
+
/// @Backport.StateObject var contact = Contact()
|
|
80
|
+
///
|
|
81
|
+
/// var body: some View {
|
|
82
|
+
/// Text(contact.name) // Accesses contact's wrapped value.
|
|
83
|
+
/// }
|
|
84
|
+
///
|
|
85
|
+
/// When you change a property of the wrapped value, you can access the new
|
|
86
|
+
/// value immediately. However, SwiftUI updates views displaying the value
|
|
87
|
+
/// asynchronously, so the user interface might not update immediately.
|
|
88
|
+
public var wrappedValue: Wrapped {
|
|
89
|
+
if let object = state.value {
|
|
90
|
+
return object
|
|
91
|
+
} else {
|
|
92
|
+
let object = thunk()
|
|
93
|
+
state.value = object
|
|
94
|
+
return object
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/// A projection of the state object that creates bindings to its
|
|
99
|
+
/// properties.
|
|
100
|
+
///
|
|
101
|
+
/// Use the projected value to pass a binding value down a view hierarchy.
|
|
102
|
+
/// To get the projected value, prefix the property variable with `$`. For
|
|
103
|
+
/// example, you can get a binding to a model's `isEnabled` Boolean so that
|
|
104
|
+
/// a ``SwiftUI/Toggle`` view can control the value:
|
|
105
|
+
///
|
|
106
|
+
/// struct MyView: View {
|
|
107
|
+
/// @Backport.StateObject var model = DataModel()
|
|
108
|
+
///
|
|
109
|
+
/// var body: some View {
|
|
110
|
+
/// Toggle("Enabled", isOn: $model.isEnabled)
|
|
111
|
+
/// }
|
|
112
|
+
/// }
|
|
113
|
+
public var projectedValue: ObservedObject<Wrapped>.Wrapper {
|
|
114
|
+
ObservedObject(wrappedValue: wrappedValue).projectedValue
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/// Creates a new state object with an initial wrapped value.
|
|
118
|
+
///
|
|
119
|
+
/// You don’t call this initializer directly. Instead, declare a property
|
|
120
|
+
/// with the `@Backport.StateObject` attribute in a ``SwiftUI/View``,
|
|
121
|
+
/// ``SwiftUI/App``, or ``SwiftUI/Scene``, and provide an initial value:
|
|
122
|
+
///
|
|
123
|
+
/// struct MyView: View {
|
|
124
|
+
/// @Backport.StateObject var model = DataModel()
|
|
125
|
+
///
|
|
126
|
+
/// // ...
|
|
127
|
+
/// }
|
|
128
|
+
///
|
|
129
|
+
/// SwiftUI creates only one instance of the state object for each
|
|
130
|
+
/// container instance that you declare. In the code above, SwiftUI
|
|
131
|
+
/// creates `model` only the first time it initializes a particular instance
|
|
132
|
+
/// of `MyView`. On the other hand, each different instance of `MyView`
|
|
133
|
+
/// receives a distinct copy of the data model.
|
|
134
|
+
///
|
|
135
|
+
/// - Parameter thunk: An initial value for the state object.
|
|
136
|
+
public init(wrappedValue thunk: @autoclosure @escaping () -> Wrapped) {
|
|
137
|
+
self.thunk = thunk
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
public mutating func update() {
|
|
141
|
+
if state.value == nil {
|
|
142
|
+
state.value = thunk()
|
|
143
|
+
}
|
|
144
|
+
if observedObject.value !== state.value {
|
|
145
|
+
observedObject.value = state.value
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
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 Foundation
|
|
10
|
+
import SwiftUI
|
|
11
|
+
|
|
12
|
+
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
|
|
13
|
+
extension Image {
|
|
14
|
+
@inlinable init(platformImage: PlatformImage) {
|
|
15
|
+
#if os(macOS)
|
|
16
|
+
self.init(nsImage: platformImage)
|
|
17
|
+
#else
|
|
18
|
+
self.init(uiImage: platformImage)
|
|
19
|
+
#endif
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
|
|
24
|
+
extension PlatformImage {
|
|
25
|
+
static var empty = PlatformImage()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#if os(iOS) || os(tvOS) || os(watchOS)
|
|
29
|
+
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
|
|
30
|
+
extension PlatformImage.Orientation {
|
|
31
|
+
@inlinable var toSwiftUI: Image.Orientation {
|
|
32
|
+
switch self {
|
|
33
|
+
case .up:
|
|
34
|
+
return .up
|
|
35
|
+
case .upMirrored:
|
|
36
|
+
return .upMirrored
|
|
37
|
+
case .down:
|
|
38
|
+
return .down
|
|
39
|
+
case .downMirrored:
|
|
40
|
+
return .downMirrored
|
|
41
|
+
case .left:
|
|
42
|
+
return .left
|
|
43
|
+
case .leftMirrored:
|
|
44
|
+
return .leftMirrored
|
|
45
|
+
case .right:
|
|
46
|
+
return .right
|
|
47
|
+
case .rightMirrored:
|
|
48
|
+
return .rightMirrored
|
|
49
|
+
@unknown default:
|
|
50
|
+
return .up
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
|
|
56
|
+
extension Image.Orientation {
|
|
57
|
+
@inlinable var toPlatform: PlatformImage.Orientation {
|
|
58
|
+
switch self {
|
|
59
|
+
case .up:
|
|
60
|
+
return .up
|
|
61
|
+
case .upMirrored:
|
|
62
|
+
return .upMirrored
|
|
63
|
+
case .down:
|
|
64
|
+
return .down
|
|
65
|
+
case .downMirrored:
|
|
66
|
+
return .downMirrored
|
|
67
|
+
case .left:
|
|
68
|
+
return .left
|
|
69
|
+
case .leftMirrored:
|
|
70
|
+
return .leftMirrored
|
|
71
|
+
case .right:
|
|
72
|
+
return .right
|
|
73
|
+
case .rightMirrored:
|
|
74
|
+
return .rightMirrored
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
#endif
|
|
@@ -0,0 +1,132 @@
|
|
|
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
|
+
/// A Image observable object for handle image load process. This drive the Source of Truth for image loading status.
|
|
13
|
+
/// You can use `@ObservedObject` to associate each instance of manager to your View type, which update your view's body from SwiftUI framework when image was loaded.
|
|
14
|
+
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
|
|
15
|
+
public final class ImageManager : ObservableObject {
|
|
16
|
+
/// loaded image, note when progressive loading, this will published multiple times with different partial image
|
|
17
|
+
@Published public var image: PlatformImage?
|
|
18
|
+
/// loaded image data, may be nil if hit from memory cache. This will only published once even on incremental image loading
|
|
19
|
+
@Published public var imageData: Data?
|
|
20
|
+
/// loaded image cache type, .none means from network
|
|
21
|
+
@Published public var cacheType: SDImageCacheType = .none
|
|
22
|
+
/// loading error, you can grab the error code and reason listed in `SDWebImageErrorDomain`, to provide a user interface about the error reason
|
|
23
|
+
@Published public var error: Error?
|
|
24
|
+
/// true means during incremental loading
|
|
25
|
+
@Published public var isIncremental: Bool = false
|
|
26
|
+
/// A observed object to pass through the image manager loading status to indicator
|
|
27
|
+
@Published public var indicatorStatus = IndicatorStatus()
|
|
28
|
+
|
|
29
|
+
weak var currentOperation: SDWebImageOperation? = nil
|
|
30
|
+
|
|
31
|
+
var currentURL: URL?
|
|
32
|
+
var successBlock: ((PlatformImage, Data?, SDImageCacheType) -> Void)?
|
|
33
|
+
var failureBlock: ((Error) -> Void)?
|
|
34
|
+
var progressBlock: ((Int, Int) -> Void)?
|
|
35
|
+
|
|
36
|
+
public init() {}
|
|
37
|
+
|
|
38
|
+
/// Start to load the url operation
|
|
39
|
+
/// - Parameter url: The image url
|
|
40
|
+
/// - Parameter options: The options to use when downloading the image. See `SDWebImageOptions` for the possible values.
|
|
41
|
+
/// - 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.
|
|
42
|
+
public func load(url: URL?, options: SDWebImageOptions = [], context: [SDWebImageContextOption : Any]? = nil) {
|
|
43
|
+
let manager: SDWebImageManager
|
|
44
|
+
if let customManager = context?[.customManager] as? SDWebImageManager {
|
|
45
|
+
manager = customManager
|
|
46
|
+
} else {
|
|
47
|
+
manager = .shared
|
|
48
|
+
}
|
|
49
|
+
if (currentOperation != nil && currentURL == url) {
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
currentURL = url
|
|
53
|
+
indicatorStatus.isLoading = true
|
|
54
|
+
indicatorStatus.progress = 0
|
|
55
|
+
currentOperation = manager.loadImage(with: url, options: options, context: context, progress: { [weak self] (receivedSize, expectedSize, _) in
|
|
56
|
+
guard let self = self else {
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
let progress: Double
|
|
60
|
+
if (expectedSize > 0) {
|
|
61
|
+
progress = Double(receivedSize) / Double(expectedSize)
|
|
62
|
+
} else {
|
|
63
|
+
progress = 0
|
|
64
|
+
}
|
|
65
|
+
DispatchQueue.main.async {
|
|
66
|
+
self.indicatorStatus.progress = progress
|
|
67
|
+
}
|
|
68
|
+
self.progressBlock?(receivedSize, expectedSize)
|
|
69
|
+
}) { [weak self] (image, data, error, cacheType, finished, _) in
|
|
70
|
+
guard let self = self else {
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
if let error = error as? SDWebImageError, error.code == .cancelled {
|
|
74
|
+
// Ignore user cancelled
|
|
75
|
+
// There are race condition when quick scroll
|
|
76
|
+
// Indicator modifier disapper and trigger `WebImage.body`
|
|
77
|
+
// So previous View struct call `onDisappear` and cancel the currentOperation
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
self.image = image
|
|
81
|
+
self.error = error
|
|
82
|
+
self.isIncremental = !finished
|
|
83
|
+
if finished {
|
|
84
|
+
self.imageData = data
|
|
85
|
+
self.cacheType = cacheType
|
|
86
|
+
self.indicatorStatus.isLoading = false
|
|
87
|
+
self.indicatorStatus.progress = 1
|
|
88
|
+
if let image = image {
|
|
89
|
+
self.successBlock?(image, data, cacheType)
|
|
90
|
+
} else {
|
|
91
|
+
self.failureBlock?(error ?? NSError())
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/// Cancel the current url loading
|
|
98
|
+
public func cancel() {
|
|
99
|
+
if let operation = currentOperation {
|
|
100
|
+
operation.cancel()
|
|
101
|
+
currentOperation = nil
|
|
102
|
+
}
|
|
103
|
+
indicatorStatus.isLoading = false
|
|
104
|
+
currentURL = nil
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Completion Handler
|
|
110
|
+
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
|
|
111
|
+
extension ImageManager {
|
|
112
|
+
/// Provide the action when image load fails.
|
|
113
|
+
/// - Parameters:
|
|
114
|
+
/// - action: The action to perform. The first arg is the error during loading. If `action` is `nil`, the call has no effect.
|
|
115
|
+
public func setOnFailure(perform action: ((Error) -> Void)? = nil) {
|
|
116
|
+
self.failureBlock = action
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/// Provide the action when image load successes.
|
|
120
|
+
/// - Parameters:
|
|
121
|
+
/// - 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.
|
|
122
|
+
public func setOnSuccess(perform action: ((PlatformImage, Data?, SDImageCacheType) -> Void)? = nil) {
|
|
123
|
+
self.successBlock = action
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/// Provide the action when image load progress changes.
|
|
127
|
+
/// - Parameters:
|
|
128
|
+
/// - 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.
|
|
129
|
+
public func setOnProgress(perform action: ((Int, Int) -> Void)? = nil) {
|
|
130
|
+
self.progressBlock = action
|
|
131
|
+
}
|
|
132
|
+
}
|