Empty Parameters

Prefer () -> over Void ->

  • Identifier: empty_parameters
  • 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

let abc: () -> Void = {}
func foo(completion: () -> Void)
func foo(completion: () throws -> Void)
let foo: (ConfigurationTests) -> Void throws -> Void)
let foo: (ConfigurationTests) ->   Void throws -> Void)
let foo: (ConfigurationTests) ->Void throws -> Void)

Triggering Examples

let abc: (Void) -> Void = {}
func foo(completion: (Void) -> Void)
func foo(completion: (Void) throws -> Void)
let foo: (Void) -> () throws -> Void)