Skip to content

Commit 164673d

Browse files
author
Tom O'Brien
committed
Add immediate check flag
1 parent 424ddbc commit 164673d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Reachability/Reachability.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public class Reachability {
142142
public extension Reachability {
143143

144144
// MARK: - *** Notifier methods ***
145-
func startNotifier() throws {
145+
func startNotifier(withImmediateCheck checkImmediately: Bool = false) throws {
146146

147147
guard let reachabilityRef = reachabilityRef, !notifierRunning else { return }
148148

@@ -159,8 +159,10 @@ public extension Reachability {
159159
}
160160

161161
// Perform an intial check
162-
reachabilitySerialQueue.async {
163-
self.reachabilityChanged()
162+
if checkImmediately {
163+
reachabilitySerialQueue.async {
164+
self.reachabilityChanged()
165+
}
164166
}
165167

166168
notifierRunning = true

0 commit comments

Comments
 (0)