kodecocodes / swift-style-guide

The official Swift style guide for Kodeco.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Function Declarations

umbrellait-mikhail-barilov opened this issue · 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.