Reachability.swift icon indicating copy to clipboard operation
Reachability.swift copied to clipboard

Allow startNotifier to optionally skip the initial check.

Open alwaysthecritic opened this issue 8 years ago • 4 comments

Because sometimes you only want to know when network comes back. Furthermore, the initial check is not on main thread which can cause some issues for clients.

Certainly we needed this change to get rid of nasty crashes and difficult thread timing behaviour in our app. In our use case we only cared to know when connectivity was re-established for auto-reload functionality. So we didn't want to initial check, and occasionally the initial callback would arrive before the result of startNotifier had actually been assigned, so we didn't have access to the Reachability object (which we wanted to check if we had WiFi or mobile access). Which caused crashes until we figured out what was going on.

alwaysthecritic avatar Apr 25 '16 07:04 alwaysthecritic

@ashleymills any update on this? seems like a very cool feature to have. I think checkImmediately is set to true by default to leave the current behavior unchanged. Am I wrong?

I can open a new PR if you don't have time to look.

ozgur avatar Oct 06 '18 11:10 ozgur

I'll take another look at this one

ashleymills avatar Oct 06 '18 11:10 ashleymills

Any update on this? I also don't want to be notified initially, only to be notified when there is a change in reachability. If you are not merging this one, can you advice me for a workaround?

SlavcoPetkovski avatar Jul 04 '19 14:07 SlavcoPetkovski

This PR has been outstanding for several years and I just had to fork the repo to accomplish the very same thing. It would be good to merge this and get it done.

bdkjones avatar Nov 22 '20 21:11 bdkjones