Void Return

Prefer -> Void over -> ().

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

Non Triggering Examples

let abc: () -> Void = {}

let abc: () -> (VoidVoid) = {}

func foo(completion: () -> Void)

let foo: (ConfigurationTests) -> () throws -> Void

let foo: (ConfigurationTests) ->   () throws -> Void

let foo: (ConfigurationTests) ->() throws -> Void

let foo: (ConfigurationTests) -> () -> Void

Triggering Examples

let abc: () -> () = {}

let abc: () -> (Void) = {}

let abc: () -> (   Void ) = {}

func foo(completion: () -> ())

func foo(completion: () -> (   ))

func foo(completion: () -> (Void))

let foo: (ConfigurationTests) -> () throws -> ()