-
Hi , show view with placeholder -> trigger download of image with a url -> (success , failure) -> (remoteImage/ fallback). strictly speaking these are seem to be effects as there is no user interaction involved and hence no actions. I cheat a bit by assuming that view's onAppear() is kind of a user intent and trigger my download. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It's not cheating to have Specifically on loading image data from the network, though, you may be interested in SwiftUI's |
Beta Was this translation helpful? Give feedback.
It's not cheating to have
onAppear
trigger an effect (via an action). As a rule of thumb, actions should represent either UI events (whether directly user-initiated or not, such as anonAppear
closure firing), or emissions from effects.Specifically on loading image data from the network, though, you may be interested in SwiftUI's
AsyncImage
view. For most of us, loading remote image data isn't our core business logic, so there's really no reason to handle that manually in a reducer; just outsource that to SwiftUI.