Post

Replies

Boosts

Views

Activity

Reply to Novice SwiftUI developer can't make network call
I have wrapped the (if let banjo) block in a dummy function and it builds. Only issue is where to run the function. I'd be happy with it running first in the program. As soon as I boot up. I suppose I could put a button in the content view that runs the function, which I assume would make the network call. Is that ok?
Topic: Design SubTopic: General
Sep ’25
Reply to Novice SwiftUI developer can't make network call
Also if you can point me to documentation that describes what the URL structure does, that might help me too. I was trying to find out why it was returning a nil value. Also what in the shared task was failing. So i was struggling to find documentation on the shared task. Again, thanks for your generous help.
Topic: Design SubTopic: General
Sep ’25
Reply to Novice SwiftUI developer can't make network call
I am not having trouble deciding what to do in my code if I get a non URL value in banjo. I'm using the same URL that I think I will always use, and that won't change. And that I'm checking is valid. That being the case I've tried pasting the code you gave me into xcode and it still won't build. Here's what I put in xcode let myString = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=AAPL&apikey= *********" if let banjo = URL(string: myString) { let Lulah = URLSession.shared.dataTask(with:banjo ) { myDatastring , response , error in} Lulah.resume() } else { myDatastring="nil url" } I'm getting a build error on the line starting "if let banjo". The build error is: "Statements are not allowed at the top level" and is tied to the first word, if. Thank you for your generous help.
Topic: Design SubTopic: General
Sep ’25