kodecocodes/swift-style-guide

Function Declarations

umbrellait-mikhail-barilov opened this issue · 1 comments

I think the preferred option and the non-preferred option are mixed up here.

Preferred:

func updateConstraints() -> Void {
  // magic happens here
}

typealias CompletionHandler = (result) -> Void
Not Preferred:

func updateConstraints() -> () {
  // magic happens here
}

typealias CompletionHandler = (result) -> ()

Thanks for your comment. However, they are not mixed up. We always prefer a keyword to empty parentheses. It’s makes the meaning clearer with no possibility for ambiguity.