Novice SwiftUI developer can't make network call

I'm trying to use URL structure in the foundation framework and it is failing to build, returning a nil value. Could it be trying to evaluate the string I am giving it as a variable for its argument at build time? Is there a test argument I can give URL to see if it can return a non-nil value? (of URL type)?

Thank you for the post regarding the issue you are experiencing with the URL structure in the Foundation framework.

Based on your description, it is possible that the string you are using as an argument is evaluated at build time, particularly if it involves compile-time constants or conditions that are not resolved correctly.

Could you please provide the code you are using? Is it something like this and returns nil?

let testURL = URL(string: "https://www.example.com")
print(testURL)

The more information you can provide, the better I can assist you. Please share the code you are using to construct the URL. Thank you.

Albert Pascual
  Worldwide Developer Relations.

Novice SwiftUI developer can't make network call
 
 
Q