My app currently shows an alert if there isn't an internet connection. However, I would like it to reconnect automatically once internet connection is detected without user needing to restart the app.
the code for I used currently is
if Reachability.isConnectedToNetwork() == true {
print("Internet Connection Available!")
} else {
let alertController = UIAlertController(title: "Alert",
message: "Internet Connection not Available!",
preferredStyle: UIAlertControllerStyle.alert)
alertController.addAction(UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.default,handler: nil))
self.present(alertController, animated: true, completion: nil)
}
anyone can give some advice? if my question isn't clear, do let me know. Thx guys!