0

Just reading through some docs I see declarations like this

  var loginSuccess: (() -> Void)?

throughout the code, I was wondering what this is called and what it's use case would be?

In this example I see

loginVC.loginSuccess = {
    self.activityIndicator.startAnimating()
    self.dismissViewControllerAnimated(true) {
        self.viewModel.fetchThreats()
    }
}

So I'm assuming it's just a closure that be invoked when an action completes. Returns nothing and accepts nothing?

Harry Blue
  • 4,202
  • 10
  • 39
  • 78

0 Answers0