ios – UIButton click function opens URL in blank screen


Learning iOS and Swift development, and I was able to get a button click to open a URL.

Within Xcode, I am running the app by clicking the play button.

When the app opens, and I click the button on the app, it takes me to the URL.

The problem is: the screen is blank.

The address bar does show the URL.

Here is a portion of the code that I wrote that opens the URL:

class ViewController: UIViewController {
    private lazy var visitwebsitebutton: UIButton = {
    let visitwebsitebutton = UIButton()
    let dtgreen = UIColor(rgb: 0x12823b)
    visitwebsitebutton.backgroundColor = .green
    visitwebsitebutton.setTitle("Visit Website", for: .normal)
    visitwebsitebutton.setTitleColor(.white, for: .normal)
    visitwebsitebutton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 18)
    visitwebsitebutton.layer.cornerRadius = 20
    visitwebsitebutton.addTarget(self, action: #selector(visitwebsitebuttonTapped), for: .touchUpInside)
    return visitwebsitebutton

@objc func visitwebsitebuttonTapped() {
    if let yourURL = URL(string: "") {
  , options: [:], completionHandler: nil)

Using the above will successfully allow the user (which is me at the moment) to click on the button, and open the URL in another window on the Xcode emulator. But the screen is blank.

My question is: does this blank screen only occur when running the app in Xcode? Will it work properly when I publish this app to the web?

Please advise.