Wow thanks for the answer, I had been searching for hours! I am still hitting an error though, I have a few buttons on the view that start disabled, then when the user successfully logs in, the buttons enable.When I putself.button.isEnabled = truein the success case, I get a message-[UIButton setEnabled:] must be used from main thread onlyso I tried to do this: submitPost(post: myPost) { (result) in switch result { case .success(let value): print(value) loginSuccessful = value //...use value here case .failure(let error): print(error) fatalError(error.localizedDescription) } }if (loginSuccessful == "Success"{ //enable Buttons}but while the print(value) does print "Success", I then try to set loginSuccessful to value, but loginSuccessful is "" outside the case and so the buttons never enable..Thanks for the help!
Post
Replies
Boosts
Views
Activity
Thanks I'll check that out. When I put the button enable lines in the submitPost code, I get this error message:-[UIButton setEnabled:] must be used from main thread only
Thanks to both of you!
Thanks SO much for the reply! I had set up the structs and gotten the result as you show, but then had used the JSONSerialzation line further on and tried to run the decode on that. I think I read one too many articles and was overcomplicating it.
Is there a way to be able to access the data in theList outside the scope of the "do"? Make it available to the entire ViewController?
Thanks *again*, worked like a charm!