Skip to content

Instantly share code, notes, and snippets.

@SmartJSONEditor
Created September 22, 2023 15:39
Show Gist options
  • Save SmartJSONEditor/eb72ecae3749d933ad3be0497550927b to your computer and use it in GitHub Desktop.
Save SmartJSONEditor/eb72ecae3749d933ad3be0497550927b to your computer and use it in GitHub Desktop.
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