by SebastianFrelle · 7y ago · 0 comments
func animate(withDuration duration: TimeInterval, animations: @escaping () -> Void, completion: ((Bool) -> Void)? = nil)
It is perfectly valid to call this function using a trailing closure for the latter argument, i.e. animate(withDuration: 0.5, animations: { ... }) {
// handle completion here
}
rendering the `completion` parameter label obsolete and giving no clear visual indication that the trailing closure is a completion handler.Again, I strongly dislike the visual similarity to control flow statements.
[1]: https://www.natashatherobot.com/swift-trailing-closure-synta...
No comments yet.