I put a print to see where code is passing and in immediate panel shows like this:
Passed 01 ===========
Passed 03 ===========
Passed 04 =========== out off func!!
2021-05-04 11:41:16.460925-0300 Fuel[2348:100030] [] nw_protocol_get_quic_image_blockinvoke dlopen libquic failed
Passou 02 ===========
Status: true
Nome: Roberto Pires
(I didn't understand libquic failed, but the problem is another one)
Seems your code is working correctly.
Well, the correct should be:
NO, it is not correct.
My code is called by a button, but returns BEFORE complete (and as so, show an incorrect Alert, because the "myJsonResponse?.status" is false at this time),
It is the right behavior, when you want to work with async methods. An async method itself returns to caller BEFORE complete, and the completion handler is executed after the task is completed.
This is called by my Login Button:
What is aspStatus? It does not appear in validatingLogin().
In the near future, you may need to learn async/await pattern in Swift, but you need to be accustomed with completion handler pattern until then.
You need to write everything you want to run after the task is completed within the completion handler.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: