Thank you Claude :-)
Post
Replies
Boosts
Views
Activity
Thank you Quinn, the users will be happy to wait until the data is retrieved - a spinning wheel would be fine.
I tried the above but I'm getting an error "type "_" cannot be used as a boolean" for the "let url" line
var quotes: [(quote: String, order: Int)];
let url = URL(string:"https://www.TEST.com/test_connection.php"){
URLSession.shared.dataTask(with: url) { (data, response, error) in
if let data = data{
if let json = try? JSONDecoder().decode([[String:String]].self, from: data){
json.forEach { row in
quotes.append((row["quote"]!, Int(row["order"]!)!))
}}}}}
OK sorry I don't think I understand, isn't "return" used for functions but "quotes" is a variable?
Thank you @darkpaw ! I'll go with the simple solution! :-)