Skip to content

Instantly share code, notes, and snippets.

@lammertw
Created April 3, 2021 17:08
Show Gist options
  • Save lammertw/519050fa62cfd115425dae884e4fa635 to your computer and use it in GitHub Desktop.
Save lammertw/519050fa62cfd115425dae884e4fa635 to your computer and use it in GitHub Desktop.
struct CountView: UIViewControllerRepresentable {
@EnvironmentObject var counter: ObservableCounter
typealias UIViewControllerType = CountViewController
func makeUIViewController(context: Context) -> CountViewController {
return CountViewController()
}
func updateUIViewController(_ uiViewController: CountViewController, context: Context) {
uiViewController.count = counter.count
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment