Order of .task vs .onAppear modifiers #48
ginnheimerCoder
started this conversation in
Lessons & Modules
Replies: 1 comment 2 replies
-
I understand your confusion! I'll have to rewrite the lesson. The statement is still true, but it's about scheduling. This would be the rewrite:
Does that clarify it better? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I came across a statement in the session „Task Cancellation“ in the task module that I want to mention.
At the end of the section „Using tasks in SwiftUI“ it says:
When I compare the order of print statements in a simple SwiftUI view, it seems to be the opposite:
When I run the SwiftUI preview in the console, I get the following output:
So to me it seems like
.onAppear
runs before the.task
modifier.Am I missing something or misunderstanding the statement in the course?
Beta Was this translation helpful? Give feedback.
All reactions