Skip to content

Instantly share code, notes, and snippets.

@nalexn
Created September 29, 2020 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nalexn/35d40926e019cadbd4988adb08eb2610 to your computer and use it in GitHub Desktop.
Save nalexn/35d40926e019cadbd4988adb08eb2610 to your computer and use it in GitHub Desktop.
extension HomeViewModel {
class Adapter: ObservableObject {
let viewModel: HomeViewModel
@Published var isLoadingData = false
}
}
struct HomeView: View {
let adapter: HomeViewModel.Adapter
var body: some View {
if adapter.isLoadingData {
ProgressView()
}
Button("Do something!") {
self.adapter.viewModel.doSomething()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment