Order of .task vs .onAppear modifiers #48
Replies: 2 comments 3 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.
-
|
This is now updated in the Task Cancellation lesson |
Beta Was this translation helpful? Give feedback.
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
.onAppearruns before the.taskmodifier.Am I missing something or misunderstanding the statement in the course?
Beta Was this translation helpful? Give feedback.
All reactions