To simplify how you could achieve it, just copy your function signature:
(animated: Bool, completion: @escaping (Bool) -> ())
and use it for declaring a typealias:
typealias Update = (animated: Bool, completion: (Bool) -> ())
You'll see syntax error as:
@escaping attribute may only be used in function parameter position
with a suggestion with removing the @escaping
, do it:
typealias Update = (animated: Bool, completion: (Bool) -> ())
At this point, you will be able to recognize the appropriate type by using the Update
typealias.
Therefore, you are able to declare your queue
array as:
var queue = [Update]()
Note that when declaring a typealias you could just avoid naming the parameters, as:
// this is sufficient
typealias Update = (Bool, (Bool) -> ())
Furthermore:
For knowing what typealias is, you could check: When to use typealias? (as well as the story mentioned in its answer)