Returning Whitespace

Return arrow and return type should be separated by a single space or on a separate line

  • Identifier: return_arrow_whitespace
  • Enabled by default: Yes
  • Supports autocorrection: Yes
  • Kind: style
  • Analyzer rule: No
  • Minimum Swift compiler version: 5.0.0
  • Default configuration:
    KeyValue
    severity warning

Non Triggering Examples

func abc() -> Int {}
func abc() -> [Int] {}
func abc() -> (Int, Int) {}
var abc = {(param: Int) -> Void in }
func abc() ->
    Int {}
func abc()
    -> Int {}
func reallyLongFunctionMethods<T>(withParam1: Int, param2: String, param3: Bool) where T: AGenericConstraint
    -> Int {
    return 1
}
typealias SuccessBlock = ((Data) -> Void)

Triggering Examples

func abc()->Int {}
func abc()->[Int] {}
func abc()->(Int, Int) {}
func abc()-> Int {}
func abc()->   Int {}
func abc() ->Int {}
func abc()  ->  Int {}
var abc = {(param: Int) ->Bool in }
var abc = {(param: Int)->Bool in }
typealias SuccessBlock = ((Data)->Void)
func abc()
  ->  Int {}
func abc()
 ->  Int {}
func abc()  ->
  Int {}
func abc()  ->
Int {}