I'm using the swift package OnboardKit and it requires a specific closure type that I cannot figure out.
The class OnboardPage requires a type OnboardPageAction for the parameter action.
public typealias OnboardPageCompletion = ((_ success: Bool, _ error: Error?) -> Void)
public typealias OnboardPageAction = (@escaping OnboardPageCompletion) -> Void
OnboardPage(title: "Title",
description: "description",
action: action)
This is my latest attempt, I tried several variations along those lines.
let action: ((_ success: Bool, _ error: Error?) -> ()) = {_,_ in
print("help")
}
XCode fails with the error message:
Cannot convert value of type '(Bool, Error?) -> Void' to expected argument type 'OnboardPageAction?' (aka 'Optional<(@escaping (Bool, Optional) -> ()) -> ()>')
What am I doing wrong here? Is the mistake in my closure definition or in the way I use it in the OnboardPage() call? Thanks :)
(I learned details about closures here Closures Swift How To, but I am not able to define the right closure type that the package expects)