Skip to main content
Removed labels and a plural
Source Link
Mark A. Donohoe
  • 30.8k
  • 29
  • 165
  • 317

ClosuresClosure types are subject to the same switching patterns that any other types are:

switch someClosure { case let runnable as () -> Void: runnable() case let intConsumer as (value: Int) -> Void: intConsumer(4) case let stringConsumer as (value: String) -> Void: stringConsumer("A") } 

Closures types are subject to the same switching patterns that any other types are:

switch someClosure { case let runnable as () -> Void: runnable() case let intConsumer as (value: Int) -> Void: intConsumer(4) case let stringConsumer as (value: String) -> Void: stringConsumer("A") } 

Closure types are subject to the same switching patterns that any other types are:

switch someClosure { case let runnable as () -> Void: runnable() case let intConsumer as (Int) -> Void: intConsumer(4) case let stringConsumer as (String) -> Void: stringConsumer("A") } 
Source Link
Alexander
  • 63.9k
  • 13
  • 106
  • 177

Closures types are subject to the same switching patterns that any other types are:

switch someClosure { case let runnable as () -> Void: runnable() case let intConsumer as (value: Int) -> Void: intConsumer(4) case let stringConsumer as (value: String) -> Void: stringConsumer("A") }