@discardableResult
allows you to not have to write _ =
is there something similar for arguments?
I have an often used function typealias that has one function parameter:
/// Some action buttons are given a dismiss function you can execute inside of your action.
/// This will allow you to dismiss whatever View is currently showing the action.
public typealias DismissFn = () -> Void
/// A generic action that happens when you press a button
public typealias MyAction = (DismissFn?) -> Void
However, everytime I use the function I have to write { _ in print("using MyAction") }
or else I get:
Contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored
It would be cool if we could add a @discardableParameters
to the function that we don't need to write _ in
everywhere and can just write { print("...") }
If not I think this could be a great addition!