I actually tried to add if-else statement in the showPage func, but it doesn't work correctly.
func openPage(action : UIAlertAction){
if let url = URL(string: "http://" + action.title!) {
webView.load(URLRequest(url: url))
}else{
let ac = UIAlertController(title: "Valid URL", message: "wrong url", preferredStyle: .alert)
ac.addAction(UIAlertAction(title: "Close", style: .cancel))
present(ac , animated: true)
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…