Fix bug where urls with scheme did not load
This commit is contained in:
@@ -244,14 +244,16 @@ class BrowserViewController: UIViewController, WKNavigationDelegate,
|
|||||||
// MARK: UITextField Delegate
|
// MARK: UITextField Delegate
|
||||||
|
|
||||||
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
||||||
if let text = textField.text, let url = URL(string: text) {
|
if let text = textField.text, var url = URL(string: text) {
|
||||||
if url.scheme == nil {
|
if url.scheme == nil {
|
||||||
let urlString = "https://\(text)"
|
let urlString = "https://\(text)"
|
||||||
if let url = URL(string: urlString) {
|
if let fixedURL = URL(string: urlString) {
|
||||||
|
url = fixedURL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tab.beginLoadingURL(url)
|
tab.beginLoadingURL(url)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
textField.resignFirstResponder()
|
textField.resignFirstResponder()
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user