'Swift code question - what this code actually do? (? : meaning in this code sample)
I have below code in my XCode project and I'm not sure how to read it apart from the fact it's a function which does not return and which seems to be calling other functions from the viewModel (correct me if I'm wrong). But what conditions are there? What does '?' and ':' do here?
@objc
func topLeftButtonTapped() {
isRootNavigationViewController
? viewModel?.close()
: viewModel?.previous()
viewModel?.didAppear()
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
