-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use Firebase Storage with SDWebImageSwiftUI #270
Comments
Emmmm... You can use the category on FirebaseStorage to create |
I am talking about |
You can check that FirebaseUI implementation (open-sourced), it create a special So, I guess if you can create that special I have no demo code here, any usable demo ? |
The magic happens here: So, if in Swift you can call to create this |
This |
To say, this ugly design can be changed in SDWebImage 6.0. We can load a thing which is not public protocol SDImageResource : NSObjectProtocol {
public var url: URL { get }
public var cacheKey: String { get }
}
public struct WebImage {
public init(_ resource: SDImageResource)
} |
Do I don't understand should I create an exact copy of that? I am using SwiftUI copying the method does not work as well. |
I dont think I understand. Look it still gives an error
|
The code above still throws |
I have got to try this if it works in this case: |
Even the method above throws an error: |
I think that you don't setup the FirebaseStorageUI correcly. Seems you use that special wrapper Which actually, should use FirebaseStorage's Loader instead, which means, the custom loader feature from SDWebImage: https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#custom-loader-50 API: https://sdwebimage.github.io/documentation/sdwebimage/sdwebimagecontextoption/imageloader |
Give me an example ? So I can test it as well. From the docs, maybe you need something like: WebImage(url: CreateURLFromFirebaseStoragreReference(),
options: 0,
context: [.imageLoader: StorageImageLoader.shared]) See the readme in FirebaseStorageUI, you can also setup the global loaders manger like this, so you don't need speciay let loader1 = SDWebImageDownloader.shared
let loader2 = StorageImageLoader.shared
SDImageLoadersManager.shared.loaders = [loader1, loader2]
// Assign loader to manager
let manager = SDWebImageManager(cache: SDImageCache.shared, loader: SDImageLoadersManager.shared)
// Start use
// If you want to assign loader to default manager, use `defaultImageLoader` class property before shared manager initialized
SDWebImageManager.defaultImageLoader = SDImageLoadersManager.shared |
All my efforts to use firebase storage reference with SDWebImageSwiftUI do not work.
import SwiftUI
import FirebaseStorage
import SDWebImage
import SDWebImageSwiftUI
import FirebaseStorageUI
I have imported all these but it does not work.
WebImage(url: imageReference)
How do I make this work?
The text was updated successfully, but these errors were encountered: