IntrepidPursuits/swift-style-guide

Address functions with multliple closures

Closed this issue · 2 comments

It can be ugly to read. I think it should be something like:

UIView.animateWithDuration(
    SomeTimeValue,
    animations: {
        // Do stuff
    },
    completion: { _ in
        // Do stuff
    }
)

The default spacing and syntax when you do this in xcode ends up looking like this:
(notice the trailing closure)
(it also tries to include the variable declarations, but I took those out)

UIView.animateWithDuration(SomeTimeValue, animations: {
    // Do stuff
    }) { _ in
        // Do stuff
}

👍

Merged.