I want to open google search for any given string, here is my code, but it does not open the search for the given string for example.
let s = "A long-running line of '80s ads urged potential pizza customers to “avoid” what?"
let search = s.replacingOccurrences(of: " ", with: "+")
if let url = URL(string: "https://www.google.com/search?q=\(search)"), NSWorkspace.shared.open(url) {
print("default browser was successfully opened")
}