If you use non-optional @State with a class type there is a memory leak because the States’s initial object is recreated every time the View struct inits. The fix is to make an optional State and init it in onAppear. However if you just use the built in .task for your timer, then you can avoid the class completely and no more problems!
Great to see you back! You are probably one of the best SwitUI instructors on UA-cam currently
the best @self vs @identity explanation! thank you
Love the animated identity changed modifier, never seen a trick like that
Thanks!
Welcome back Karin 😀
Very interesting video!
Learnt a lot from this, thank you!
If you use non-optional @State with a class type there is a memory leak because the States’s initial object is recreated every time the View struct inits. The fix is to make an optional State and init it in onAppear. However if you just use the built in .task for your timer, then you can avoid the class completely and no more problems!
thanks!