Last active
March 19, 2022 19:53
-
-
Save GerardPaligot/fa04c4840fed556ff5a69ef0bc89e30c 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 Networking: View { | |
@ObservedObject var viewModel: NetworkingViewModel | |
// state to displau a sheet | |
@State private var isPresentingScanner = false | |
var body: some View { | |
let uiState = viewModel.uiState | |
NavigationView { | |
Group { | |
Networking(networkingUi: uiState.networkingUi) | |
} | |
// use the state to display the sheet or not | |
.sheet(isPresented: $isPresentingScanner) { | |
CodeScannerView(codeTypes: [.qr]) { response in | |
if case let .success(result) = response { | |
// close the sheet | |
isPresentingScanner = false | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment