79347332

Date: 2025-01-11 01:08:11
Score: 1
Natty:
Report link

@Stu's answer works well with me, I made it as a modifier for easier usage.

extension View {

    func refreshablePersistent(_ operation: @escaping () async -> Void) -> some View {
    self
        .refreshable {
            await Task {
                await operation()
            }.value
        }
    }
}

The issue I'm having in my case is that viewModel.load() update viewState which @Published to show a loading indicator, That causes a redraw -> task cancelled :) also load has many request made consecutively, each updates the ui.

Idk but if I understand it well I shouldn't update the ui until all requests are finished. Can be implemented but needs a lot of fining.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Stu's
  • Low reputation (1):
Posted by: Saud Alhafith