-
| Hi! I'm experimenting with TCA and I'd like to create a page tab view. My code is: So this way when I start the app it prints: and if I swipe to change tab, on every tab change all of the  However, if I change the  it prints the same thing ONCE and no more on tab changes. Am I missing something? Or is this a bug? Any ideas? | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
| Hey @csbence10, thanks for the discussion and I was able to reproduce this too. It's very strange. There must be some kind of special SwiftUI magic when using  FWIW, you should't fret too much about the  | 
Beta Was this translation helpful? Give feedback.
Hey @csbence10, thanks for the discussion and I was able to reproduce this too. It's very strange. There must be some kind of special SwiftUI magic when using
@Statebindings inTabViewthat prevents the additionalinits. If you convert the@Stateto@ObservedObjectyou will see that theinits are called gain. So definitely seems like a SwiftUI bug 😬.FWIW, you should't fret too much about the
.initcalls. Since you should never do series work in the initializer of a view those calls are usually not a problem. It's the calls to thebodythat can be expensive (with sufficiently complex view hierarchies), and theWithViewStoreis preventing those from being invoked too many times.