-1

Before I start, I want to let you know that I am not a good English speaker. But if you answer me, I will translate the best I can.

I couldn't find the answer for "What should I do to access the URL". I just wanted to make a URL instance in Playgrounds, but it won't work.

Why is this not working?

Swift Playgrounds

George
  • 25,988
  • 10
  • 79
  • 133
BDios
  • 1
  • 1
    You should show the actual error message, not just the fact that there is an error. Also, include all relevant code as text using proper code formatting instead of including it as a screenshot. – Dávid Pásztor Jan 16 '20 at 13:34
  • Have you imported Foundation? (import Foundation) – Orion Cygnus Jan 16 '20 at 14:00
  • It should work with UIKit. if not just restart your Xcode. If you import UIKit you do not need to import Foundation because it already contains it. – multitudes Jan 20 '20 at 11:14

1 Answers1

0

Name it like as follows

let url = URL(string: "http://www.stackoverflow.com")
//            ^ type ESC after ( for constructors autocompleation
Asperi
  • 228,894
  • 20
  • 464
  • 690