Skip to content

Commit

Permalink
Add immediate check flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom O'Brien committed Feb 28, 2017
1 parent 424ddbc commit 164673d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Reachability/Reachability.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public class Reachability {
public extension Reachability {

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

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

Expand All @@ -159,8 +159,10 @@ public extension Reachability {
}

// Perform an intial check
reachabilitySerialQueue.async {
self.reachabilityChanged()
if checkImmediately {
reachabilitySerialQueue.async {
self.reachabilityChanged()
}
}

notifierRunning = true
Expand Down

0 comments on commit 164673d

Please sign in to comment.