Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Commit

Permalink
Remove redundant Void from empty closure parameters
Browse files Browse the repository at this point in the history
It is enough to just write `() -> Void` instead of
`(Void) -> Void`. In addition the explicit `Void`
was causing this warning:
"When calling this function in Swift 4 or later,
you must pass a '()' tuple". Now it is fixed.
  • Loading branch information
wojciechczerski committed Oct 12, 2017
1 parent 7e5ea68 commit 04463f8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions SwiftMonkey/Monkey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ public class Monkey {
var r: Random
let frame: CGRect

var randomActions: [(accumulatedWeight: Double, action: (Void) -> Void)]
var randomActions: [(accumulatedWeight: Double, action: () -> Void)]
var totalWeight: Double

var regularActions: [(interval: Int, action: (Void) -> Void)]
var regularActions: [(interval: Int, action: () -> Void)]
var actionCounter = 0

/**
Expand Down Expand Up @@ -191,7 +191,7 @@ public class Monkey {
- parameter action: The block to run when this event
is generated.
*/
public func addAction(weight: Double, action: @escaping (Void) -> Void) {
public func addAction(weight: Double, action: @escaping () -> Void) {
totalWeight += weight
randomActions.append((accumulatedWeight: totalWeight, action: action))
}
Expand All @@ -205,7 +205,7 @@ public class Monkey {
- parameter action: The block to run when this event
is generated.
*/
public func addAction(interval: Int, action: @escaping (Void) -> Void) {
public func addAction(interval: Int, action: @escaping () -> Void) {
regularActions.append((interval: interval, action: action))
}

Expand Down

0 comments on commit 04463f8

Please sign in to comment.