Sign in
Log inSign up
Xavier

1 like

·

4.5K reads

3 comments

Jesse Lindberg
Jesse Lindberg
Sep 26, 2023

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.

·
·1 reply
Abdurahmon Jamoliddinov
Abdurahmon Jamoliddinov
Jan 9, 2024

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

·
Viraj Shah
Viraj Shah
Oct 26, 2023

Loved this implementation. Simple concept that is easy to integrate without having to add a lot of code.

·