Closed lickel closed 1 year ago
Simple enough, but can you clarify why you would ever need to access this value directly? If you need to download an image, I'd suggest wrapping an ImageDownloader
into a SwiftUI view so you can take advantage of all of the AlamofireImage features.
I am using ImageDownloader
. My issue is I want the same URLRequest that I would get from UIImageView.setImage(withURL...)
Those conversions are all in private extension functions with the form:
private func urlRequest(with url: URL) -> URLRequest {
var urlRequest = URLRequest(url: url)
for mimeType in ImageResponseSerializer.acceptableImageContentTypes.sorted() {
urlRequest.addValue(mimeType, forHTTPHeaderField: "Accept")
}
return urlRequest
}
The other alternative would be to expose that func urlRequest(with url: URL)
behavior publicly, e.g on ImageDownloader
Makes sense. This is probably an okay change, but I'll think about it more.
@jshier have you had a chance to give this more thought?
Makes sense, I just need to do some other updates before I can test and merge.
Just following up; do you think you'd be willing to merge this in?
Goals :soccer:
Expose
ImageResponseSerializer.acceptableImageContentTypes
for read-only consumption by API consumers.Implementation Details :construction:
I have had a few instances where I need to express valid content types. The most recent use case was within a SwiftUI view where I wanted to download an image directly.
Testing Details :mag:
n/a