1 Reply
      Latest reply on May 10, 2020 6:53 AM by OOPer
      vivek94 Level 1 Level 1 (0 points)
        let urlString = "www.google.com"
        let url = URL(string: urlString)
        

        It always gives nill instead of URL.

        Creared New Project.

        Swift 5

        Xcode : 11.4.1

        • Re: Not able to Create URL in Swift 5
          OOPer Level 8 Level 8 (6,095 points)

          How have you checked it is nil ?

          let urlString = "www.google.com"
          let url = URL(string: urlString)
          print(url)
          
          

          I get

          Optional(www.google.com)

           

          Xcode has some bug that shows nil in the debug area for some structs even when it is not nil. Please do not rely on it.