Post

Replies

Boosts

Views

Activity

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)?
Topic: Design SubTopic: General
1
0
115
15h
Can't get a simple network call working. Novice developer.
Here is my code and the error code being generated during build. let myString : String = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=AAPL&apikey= D5GY7HKODE66G0T9" var banjo = URL(string: myString) let task = URLSession.shared.dataTask(with:banjo ) { myDatastring , response , error in} // task.resume() I've tested that URL in my browser and it works. But when I try to build I get: Value of optional type 'URL?' must be unwrapped to a value of type 'URL' Please tell me what I'm doing wrong. I think the URL struct is not returning a URL type of object.
Topic: Design SubTopic: General
2
0
257
5d