Skip to content

Modeling Async Images #2903

Answered by kamcma
Dg00 asked this question in Q&A
Mar 8, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

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 an onAppear 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.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@kamcma
Comment options

@Dg00
Comment options

Answer selected by Dg00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants