I trying to open url with UIApplication.shared.open function but i'm little bit confused because its not working for www.google.com and its working for https://www.google.com.
struct GetIsoCode: View {
@State var titile = "www.google.com"
var body: some View {
Text(titile)
.onTapGesture {
let urlS = URL(string:titile)
if let url = urlS {
UIApplication.shared.open(url) { (response) in
print(response)
}
}
}
}
}
First Use case:
Input url:
www.google.com
Output:
Failed to open URL www.google.com: Error Domain=NSOSStatusErrorDomain Code=-50 "invalid input parameters" UserInfo={NSDebugDescription=invalid input parameters, _LSLine=234, _LSFunction=-[_LSDOpenClient openURL:options:completionHandler:]}
Second Use case:
Input:
https://www.google.com
Result: It's working fine.
Can someone please explain to me how to show google from both links, I've tried to implement by above but no results yet.