The following code (shot for brevity):
private lazy var googleViewController = { return GoogleSignInViewController() }() private lazy var timerViewController = { return TimerViewController() }()
causes this error:
MainViewController.swift: 26: 6: Unable to cause closure of type '() β UIViewController' using argument list of type '()'
Explicitly pasting one of my view controllers fixes the problem:
private lazy var timerViewController: TimerViewController = { return TimerViewController() }()
However, I still do not understand the cause of the error and why this corrects the situation. I suppose this is somehow related to the type of output, but not sure about the details. What happens to my code?
I understand that I do not need to use closures in the code above, this means illustrative code
source share