I’ve got a function like this:
func next(step: Int = 1){
//....
}
And now I would like to define a type alias so that I can easily pass around this function.
However I am not able to find a way to declare that the first argument has a default value. I tried things like this
typealias ActionNext = (step: Int = default) -> ()
var nextFunc: ActionNext = next
but they all give me a error message like
Default argument not permitted in a tuple type
Is there any way to define a type for this kind of function?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…