You'll need to use an inert view modifier.
Something along the lines of:
var body: some View {
CatRecorder()
.carStyle(dayTime ? .nightTime : .noStyle)
}
This way SwiftUI knows that this is the same view where the style might change.
With this declaration, the view identity is preserved, but its value (in this case the style value) might change over time
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: