Learn Courses My Dashboard

Code execution sequence

So, I’m at M2C4. I have learned some other coding language. Most of them are executed from top to bottom. But in xcode seems like lots of these buttons or loops are after the list instance, but it still executed. Can someone give me a little education about this ?

Welcome to the community!
Can you paste which code specifically you’re confused about

Paste your code in as text, rather than providing a screenshot.

To format the code nicely, place 3 back-ticks ``` on the line above your code and 3 back-ticks ``` on the line below your code. The 3 back-ticks must be the ONLY characters on the line. The back-tick character is located on the same keyboard key as the tilde character ~ (which is located below the Esc key). You can also highlight an entire code block and click the </> button on the toolbar to wrap the block for you.

This also makes it easier for anyone assisting as they can copy the code and carry out some testing.

@jgao2

In SwiftUI you can place View components (be they a Button, List, Text etc) wherever you like inside the body property but the placement of the View objects in the body are generally so that the User Interface looks sensible and that is entirely up to the developer.

As Mikaela is suggesting, post your code that you are confused about or have questions about and we can respond and point you in the right direction.