Converting String to URL in swift 4

let str : String = "www.google.com"
let url = URL(string: str.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)!)
print(url)