---
title: "Comment by Jesse Lindberg on \"Image Caching in SwiftUI\" | Hashnode"
description: "Hey Xavier! Good stuff, thanks for the article. I was wondering, how would you handle uploading a local file and having it immediately reflect in the UI? Becaus"
url: "https://hashnode.com/posts/image-caching-in-swiftui/643f6feed57814777ce8cebf/comment/651271c20e30bf4ef5d7d49c"
---

[Discussion](https://hashnode.com/posts/image-caching-in-swiftui/643f6feed57814777ce8cebf)

Comment [Image Caching in SwiftUI](https://hashnode.com/posts/image-caching-in-swiftui/643f6feed57814777ce8cebf)

[Jesse Lindberg](https://hashnode.com/@lndbrg)

[Sep 26, 2023](https://hashnode.com/posts/image-caching-in-swiftui/643f6feed57814777ce8cebf/comment/651271c20e30bf4ef5d7d49c)

Hey Xavier! Good stuff, thanks for the article.

I was wondering, how would you handle uploading a local file and having it immediately reflect in the UI? Because the Image views use instances of ImageLoader to load the image, which makes it hard to access those instances and change the image.

Let's say I have photosPicker, from where I get the image data from PhotosPickerItem for a newly uploaded image. But I can't wrap my head around how I'd get that new data into the ImageLoader instances that are already being used (and now with the old, outdated image) in my views.

[Abdurahmon Jamoliddinov](https://hashnode.com/@abdudev)

[Jan 9, 2024](https://hashnode.com/posts/image-caching-in-swiftui/643f6feed57814777ce8cebf/comment/651271c20e30bf4ef5d7d49c#reply-659ce10fb80581bc195df33d)

I used fileImporter and got local URL to image then I am getting data for URL like the following

let \_ = fileUrl.startAccessingSecurityScopedResource() let file = try Data(contentsOf: fileUrl) fileUrl.stopAccessingSecurityScopedResource()

then I am uploading the data to my server and getting URL and displaying that in my ImageView

if that helps
