App Builds fine, but will not do anything or preview

I originally started out in playgrounds. Some background I'm new to Swift but not programming in general. Anyways in both playgrounds and Xcode, my app stopped previewing. I can build the app just fine.. but nothing happens and appears. I get no errors other than the app took too long to load.

Here are the diagnostics from Xcode --->

PreviewUpdateTimedOutError: Updating took more than 5 seconds

Updating a preview from in MathMaddness.app (41055) took more than 5 seconds.

I just had a lengthy battle with getting State working. Including observable objects, stateObjects etc. I finally fixed everything and now nothing will preview anymore.

Thanks for the help

UPDATE: Infinite loop that updated state that updated the state of swiftui.

Answered by SpaceLobster in 751485022

FIXED: Look out for infinite loops updating state

I think we need more details about this issue. Code snippets might help. To me, the diagnostics log says it may be related with your View's previews... Try to trace the issue and find what part of your code is causing it. You can undo each modification you made until you reach the state in which it works.

I had a function changing state infinitely changing in a while loop.

Ok! Is your issue fixed now?

If your issue is fixed, maybe you can place this info in a new reply and mark it as correct, so others who have similar issues find this thread. Good luck with your submission!

I'd love to mark it as fixed and correct. But not sure how to on these forums :/

Accepted Answer

FIXED: Look out for infinite loops updating state

App Builds fine, but will not do anything or preview
 
 
Q