Created
November 29, 2017 07:12
-
-
Save arabdevteam/bb1bef0d8632b6eb5edc592522255959 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// creating a function to enable our textField to load the webView with new requests and this function used specifically to use search key as a search button.. | |
func textFieldShouldReturn(_ textField: UITextField) -> Bool { | |
let url = URL(string: textField.text!) // assigning textField value to url | |
let request = URLRequest(url: url!) // making a request based on textField input text | |
myWeb.loadRequest(request) // loading webView with the request | |
textField.text = url?.relativeString // updating TextField with url string | |
textField.resignFirstResponder() // keyboard dismissal upon clicking search key | |
return true // search key as a search button | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment