I have a webview app, after the lauchScreen it goes to the ViewController where it loads the page, I have a class that does the check if there is a connection, and if it does not exist I would like to open a new screen warning that it is offline or show a button of a reload in the app, in order to try to open again and if there is connection the app open normally.
Follow the code:
class ViewController: UIViewController {
@IBOutlet weak var WebView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
if(CheckInternet.Connection()){
let url = URL(string: "https://google.com")
let request = URLRequest(url:url!)
WebView.load(request)
}else{
//caso n tenha conexão com a internet
}
}
}