Created
September 22, 2023 15:39
-
-
Save SmartJSONEditor/eb72ecae3749d933ad3be0497550927b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentWrapperView: View { | |
@State var redrawTrigger: Bool = false | |
let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect() | |
var body: some View { | |
VStack { | |
Text("Redraw triggered with bool: \(redrawTrigger)") | |
ContentView() /// On every redraw, new viewModel instance is allocated in ContentView | |
} | |
.onReceive(timer) { _ in | |
self.redrawTrigger.toggle() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment