Skip to content
Discussion options

You must be logged in to vote

Yes, you probably do not want to use .task.

I personally would recommend creating your own kind of onFirstAppear view modifier that that acts like onAppear, but fires its closure only once. You would use some local @State in the modifier to determine that condition. You can also find versions of it online if you do not want to make your own.

I would not recommend storing that state in your feature. It just isn't that important for your feature's logic, and so is fine to let the view take care of it.

Replies: 1 comment 2 replies

Comment options

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

@mbrandonw
Comment options

Answer selected by vykut
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