Strange delay when opening a view #2993
-
Hey guys. Hope you are doing well! I'm having strange issue with using TCA. It's a hybrid project, where we are trying to implement some components with TCA version 1.9.2. The issue is that when I press a button, which just adds a TCA view on the screen, it takes about 2 seconds to show it. No matter how complicated it is, like if it only has a couple of Text components in it, it still takes 1.5-2 seconds to show up.
Just to show the approach, here are child views without the View code for simplicity.
And the other one
Thanks in advance! Best regards, UPD: We tried to add a couple more scopes, and we've got a fascinating result of waiting for 34 seconds to load a simple view, which we have no issues with showing without using TCA. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Hi @Paul-Svetlichny, no there is no penalty to creating a There's really not much we can do to help without a minimal project that reproduces the problem. Can you try providing something? Also the time profiler can help find stack frames that take a long time to execute. |
Beta Was this translation helpful? Give feedback.
@Paul-Svetlichny If you support <iOS 17 and are using observation tools, you must install
WithPerceptionTracking
views for iOS 16 and less to actually update the UI when state changes are observed.In Debug builds, we emit runtime warnings when we detect access to observable state in a view that is not using
WithPerceptionTracking
. These runtime warnings are meant to help you catch bugs in your app before releasing it to your users. While we do our best to make these checks speedy, it is still quite an expensive thing to analyze at runtime, and involves demangling Swift symbols in the stack. So these are just trade-offs to back-porting observation and making it easy to catch moments whereW…