I want to open a URL in the SFSafariViewController but it says that the URL is nil although it is not nil.
let userURL = self.user?.url
let url = URL(string: "https://www.\(userURL))")
print(userURL)
print(url)
let webVC = SFSafariViewController(url: url!)
self.present(webVC, animated: true, completion: nil)
For the print statesments i get the following:
print(userURL) -> Optional("linkedin.com/in/bob-tarantino-a5778194/")
print(URL) -> nil
Fatal error: Unexpectedly found nil while unwrapping an Optional value
The error is probably caused by using the variable "userURL" inside the URL String as it does not cause any errors if the URL contains a normal String but i do not know how to fix it.