You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note this SVG plugin previously need a new UIView subclass SVGKImageView. Which is not what AnimatedImage based on. However, it can be applied with iOS 13’s native support via private API CoreSVG.framework
However, seems the best vector format on iOS platform. is the PDF, which Apple have all built-in support. I strongly recommend to create Vector PDF instead. Which is portable and easy to use compared to SVG.
I'm not adding xcode. Dont You have a library for SwiftUI.
Emm. I guess you means:
I can not add SDWebImagePDFCoder/SDWebImageSVGCoder to Xcode using SwiftPM ? Don't you have a SwiftPM library for that ?
Those two coder plugins does not support SwiftPM now. Because some of them, using the upstream dependency which does not support SwiftPM (dependency is a recursive problem). You can try to use CocoaPods firstly (try our demo, see readme), CocoaPods is easy and the most adoptable dependency manager in Cocoa.
But if you want, I can provide a special compatble version which use SwiftPM (those PDF/SVG coder)
So, it's supported. Here is the run demo with some sample SVG/PDFs. Note only AnimatedImage is supported, because it use a UIImageView, where UIKit support it.
WebImage and SwiftUI.Image does not support PDF/SVG or any vector format, its layout system hard-coded to support bitmap image in their implementation (Developer can not as well). Send Radar to Apple's SwiftUI team, if you want next year's SwiftUI support vector format (I don't think they'll support this until a new major version release)
No code actually. Just use the coders and AnimatedImage, checkout the demo and readme again.
// AppDelegate.swift
importUIKitimportSDWebImageimportSDWebImageWebPCoderimportSDWebImagePDFCoderimportSDWebImageSVGCoder@UIApplicationMainclassAppDelegate:UIResponder,UIApplicationDelegate{funcapplication(_application:UIApplication,didFinishLaunchingWithOptionslaunchOptions:[UIApplication.LaunchOptionsKey:Any]?)->Bool{
// Override point for customization after application launch.
// Add WebP support
SDImageCodersManager.shared.addCoder(SDImageWebPCoder.shared)SDImageCodersManager.shared.addCoder(SDImagePDFCoder.shared)SDImageCodersManager.shared.addCoder(SDImageSVGCoder.shared)returntrue}}
// ContentView.swift
varbody:someView{AnimatedImage(url:"https://raw.githubusercontent.com/icons8/flat-color-icons/master/pdf/stack_of_photos.pdf")}
Or just use CocoaPods. I don't like SwiftUI actually (it's a young toy with compared to other package manager for real-world complicated software develop and dependency).
SwiftUI is good for me. Increased my coding and design skills. I just started writing. Well, can't you make the Swift Pack compatible? I don't want to upload pods :(
@mkalayci35 WebP coder does not support SwiftPM. This is because libwebp (The upstream dependency) does not support. Simple answer. The repo is maintained by Google. It's better to ask them for help.
If you want to see all our coder plugins to support SwfitPM, this need time. Previouslly, I need to wait the codec author (Google, for example, the maintainer of libwebp) to support it.
However, if they can not, we have another backup solution, to just fork their repo and provide one support. Though I don't like this, but it's a reasonable solution.
But since SwiftPM is sucked to just use Git Tag for version. Which means, since there're already libwebp v1.0.3 version tagged. If I want to support SwiftPM, I have 3 choices:
I can Re-tag that v1.0.3 tag, with another commit (This may break some users, since commit HASH changed)
I can Re-create another repo, but which make maintain a pain (Once libwebp release v1.0.4, we need to go through 3 independent git repo)
I can wait for Google to release v1.0.4. But from histroy, this need half a year. And for some codecs like libbpg or libaom, it does not get any version release since last year. Really slow to wait.
Both of them are not a really good idea for me. This is reason why I delay the support of our coder plugins for SwiftPM. Until some one have a better idea or we have to choose one.
Only AnimatedImage supports vector rendering. You can dynamic change to any size without lossing details.
The Animated ImageView will show a PDF or SVG label if it supports vector rendering.
The WebImage does not support vector image. But it can use the bitmap rendering, which means we decode SVG/PDF as a bitmap image, but it will looks blur when scaling. You can check our Demo code to see how we do that: AppDelegate.swift
No code actually. Just use the coders and AnimatedImage, checkout the demo and readme again.
// AppDelegate.swift
importUIKitimportSDWebImageimportSDWebImageWebPCoderimportSDWebImagePDFCoderimportSDWebImageSVGCoder@UIApplicationMainclassAppDelegate:UIResponder,UIApplicationDelegate{funcapplication(_application:UIApplication,didFinishLaunchingWithOptionslaunchOptions:[UIApplication.LaunchOptionsKey:Any]?)->Bool{
// Override point for customization after application launch.
// Add WebP support
SDImageCodersManager.shared.addCoder(SDImageWebPCoder.shared)SDImageCodersManager.shared.addCoder(SDImagePDFCoder.shared)SDImageCodersManager.shared.addCoder(SDImageSVGCoder.shared)returntrue}}
// ContentView.swift
varbody:someView{AnimatedImage(url:"https://raw.githubusercontent.com/icons8/flat-color-icons/master/pdf/stack_of_photos.pdf")}
thank you so much my app really work now Thank you so so much!!
Or you can just mixed to use AppDelegate and SwiftUI at the same time. SwiftUI is not magic, it still need UIHostingViewController for hosting your pure SwiftUI view. AppDelegate is still here even you use @main.
The SwiftUI.App's main method initialize one UIHostingViewController and initialize a UIWindow in the implementation.
@dreampiggy I'm getting this error while following the instructions both on your comment and on this thread. Unless I'm missing something on a pure SwiftUI project. Thanks for the links btw!
Activity
dreampiggy commentedon Nov 11, 2019
SDWebImage’s decoding system is plugin based and extensiable.
Here we already have one https://github.com/SDWebImage/SDWebImageSVGCoder
Note this SVG plugin previously need a new UIView subclass
SVGKImageView. Which is not whatAnimatedImagebased on. However, it can be applied with iOS 13’s native support via private API CoreSVG.frameworkCheckout that SVGCoder’s https://github.com/SDWebImage/SDWebImageSVGCoder/tree/iOS13_SVG branch, which can be used with our
AnimatedImagestruct (because SDAnimatedImageView is subclass of UIImageView)dreampiggy commentedon Nov 11, 2019
However, seems the best vector format on iOS platform. is the PDF, which Apple have all built-in support. I strongly recommend to create Vector PDF instead. Which is portable and easy to use compared to SVG.
Using https://github.com/SDWebImage/SDWebImagePDFCoder can simply add support to PDF vector without lossing details, you can try to use our demo and run the showcase code.
productdevbook commentedon Nov 11, 2019
I'm not adding xcode. Dont You have a library for SwiftUI.
dreampiggy commentedon Nov 11, 2019
Emm. I guess you means:
Those two coder plugins does not support SwiftPM now. Because some of them, using the upstream dependency which does not support SwiftPM (dependency is a recursive problem). You can try to use CocoaPods firstly (try our demo, see readme), CocoaPods is easy and the most adoptable dependency manager in Cocoa.
But if you want, I can provide a special compatble version which use SwiftPM (those PDF/SVG coder)
dreampiggy commentedon Nov 11, 2019
@mkalayci35
PDFCoder support SwiftPM and watchOS: https://github.com/SDWebImage/SDWebImagePDFCoder/releases/tag/0.4.0
dreampiggy commentedon Nov 11, 2019
@mkalayci35
SVGCoder
iOS13_SVGbranch support SwiftPM, watchOS, and remove the SVGKit: https://github.com/SDWebImage/SDWebImageSVGCoder/commits/iOS13_SVGdreampiggy commentedon Nov 11, 2019
So, it's supported. Here is the run demo with some sample SVG/PDFs. Note only
AnimatedImageis supported, because it use aUIImageView, where UIKit support it.WebImageandSwiftUI.Imagedoes not support PDF/SVG or any vector format, its layout system hard-coded to support bitmap image in their implementation (Developer can not as well). Send Radar to Apple's SwiftUI team, if you want next year's SwiftUI support vector format (I don't think they'll support this until a new major version release)dreampiggy commentedon Nov 11, 2019
macOS Demo as well:
productdevbook commentedon Nov 11, 2019
Can you send me the sample code?
dreampiggy commentedon Nov 11, 2019
No code actually. Just use the coders and
AnimatedImage, checkout the demo and readme again.productdevbook commentedon Nov 11, 2019
dreampiggy commentedon Nov 11, 2019
Specify branch. I already mentioned, use
iOS13_SVGbranch.dreampiggy commentedon Nov 11, 2019
Or just use CocoaPods. I don't like SwiftUI actually (it's a young toy with compared to other package manager for real-world complicated software develop and dependency).
productdevbook commentedon Nov 11, 2019
SwiftUI is good for me. Increased my coding and design skills. I just started writing. Well, can't you make the Swift Pack compatible? I don't want to upload pods :(
4 remaining items
productdevbook commentedon Nov 11, 2019
would you do that branch ıos 13 thank you

productdevbook commentedon Nov 11, 2019
THANK YOU :)

dreampiggy commentedon Nov 12, 2019
@mkalayci35 WebP coder does not support SwiftPM. This is because libwebp (The upstream dependency) does not support. Simple answer. The repo is maintained by Google. It's better to ask them for help.
If you want to see all our coder plugins to support SwfitPM, this need time. Previouslly, I need to wait the codec author (Google, for example, the maintainer of libwebp) to support it.
However, if they can not, we have another backup solution, to just fork their repo and provide one support. Though I don't like this, but it's a reasonable solution.
Or we can use our Carthage package repo: https://github.com/SDWebImage/libwebp-Xcode. To add support here. Here already a PR: SDWebImage/libwebp-Xcode#3
dreampiggy commentedon Nov 12, 2019
But since SwiftPM is sucked to just use
Git Tagfor version. Which means, since there're already libwebp v1.0.3 version tagged. If I want to support SwiftPM, I have 3 choices:Re-tagthat v1.0.3 tag, with another commit (This may break some users, since commit HASH changed)Re-createanother repo, but which make maintain a pain (Once libwebp release v1.0.4, we need to go through 3 independent git repo)Both of them are not a really good idea for me. This is reason why I delay the support of our coder plugins for SwiftPM. Until some one have a better idea or we have to choose one.
dreampiggy commentedon Nov 13, 2019
@mkalayci35 The SDWebImageSVGCoder v1.0.0 released. We drop the original SVGKit support into another repo.
For you, the
iOS13_SVGbranch is already merged and deleted. You can just using SwiftPM to specify~> 1.0version of the SVGCoder for usage.dreampiggy commentedon Nov 15, 2019
@mkalayci35 Another note:
AnimatedImagesupports vector rendering. You can dynamic change to any size without lossing details.The Animated ImageView will show a
PDForSVGlabel if it supports vector rendering.WebImagedoes not support vector image. But it can use the bitmap rendering, which means we decode SVG/PDF as a bitmap image, but it will looks blur when scaling. You can check our Demo code to see how we do that: AppDelegate.swiftmrtrinh5293 commentedon Aug 11, 2020
thank you so much my app really work now Thank you so so much!!
netgfx commentedon Dec 21, 2020
How do you initialise the SVG Coder for a SwiftUI project? It doesn't have an AppDelegate file. Thanks!
dreampiggy commentedon Dec 22, 2020
For pure SwiftUI project, just use
UIApplicationDelegateAdaptor. See Apple's documentation.https://developer.apple.com/documentation/swiftui/uiapplicationdelegateadaptor
https://www.hackingwithswift.com/quick-start/swiftui/what-is-the-uiapplicationdelegateadaptor-property-wrapper
dreampiggy commentedon Dec 22, 2020
Or you can just mixed to use AppDelegate and SwiftUI at the same time. SwiftUI is not magic, it still need
UIHostingViewControllerfor hosting your pure SwiftUI view. AppDelegate is still here even you use@main.The
SwiftUI.App'smainmethod initialize oneUIHostingViewControllerand initialize a UIWindow in the implementation.netgfx commentedon Dec 22, 2020
@dreampiggy I'm getting this error while following the instructions both on your comment and on this thread. Unless I'm missing something on a pure SwiftUI project. Thanks for the links btw!
dreampiggy commentedon Dec 23, 2020
@netgfx Found you're really new to iOS dev.
The UIApplicationDelegate, is a protocol, so, you must implementation the code in a protocol method.
Normally, put this into the https://developer.apple.com/documentation/appkit/nsapplicationdelegate/1428385-applicationdidfinishlaunching this method.
Suggestion: You can start learning iOS dev by a full tutorial, not just try something from the part. Like: