ezefranca / EFInternetIndicator

❌📱 A little swift Internet error status indicator using ReachabilitySwift
Other
129 stars 16 forks source link

app delegate #4

Open jackpaster opened 6 years ago

jackpaster commented 6 years ago

@ezefranca Is there anyway to check internet from app delegate instead of going into each view controller and writing these lines of code.

MuhammadNayabButt commented 6 years ago

This is how I did this and I think its also mentioned in documentation.

Create a BaseViewController and inherit it from "InternetStatusIndicable" then create an instance var internetConnectionIndicator: InternetViewIndicator?

Then in viewDidLoad write this function self.startMonitoringInternet(message: SHOW_INTERNET_ISSUE)

Finally subclass every view controller with your BaseViewController.

This way you can avoid the hassle

ezefranca commented 6 years ago

@jackpaster You can do like the @MuhammadNayabButt said, by inheritance or using protocol oriented approach. It's depends of your project and opinion. But to use in all view controllers, it's depends them follow the protocol or inherite from other object.