I need a closure method executed on demand.
In Swift 3 I used to do something like this:
// Declare closure
var checksPerformed: ((Void) -> Void)? // Declaration
// Call when needed
checksPerformed?()
//Only executes when checksPerformed is called
checksPerformed = { _ in
// do stuff here
}
In Swift 4 this is no longer the case.
And after fixing this warning nothing works as before. What is the new way of doing this?
If I'm updating the declaration to: var checksPerformed: (() -> ())?
I'm getting