Created
September 29, 2020 23:01
-
-
Save nalexn/3c6fb6f64b46c9cd1aa30dbd9033ac9c to your computer and use it in GitHub Desktop.
Article_009 https://nalexn.github.io/uikit-switfui/
This file contains hidden or 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 HomeView: View { | |
let viewModel: HomeViewModel | |
@State var isLoadingData = false | |
var body: some View { | |
if isLoadingData { | |
ProgressView() | |
} | |
Button("Do something!") { | |
self.viewModel.doSomething() | |
} | |
.onReceive(viewModel.isLoadingData.publisher) { | |
self.isLoadingData = $0 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment