jakeheis / SwiftCLI

A powerful framework for developing CLIs in Swift
MIT License
861 stars 72 forks source link

How can a command wait for some action happen ? #98

Closed amadeu01 closed 3 years ago

amadeu01 commented 4 years ago

I would like to make some calls to a webserver and only finish the command after get some answer. How could I achieve this?

mkll commented 3 years ago

@amadeu01 Use something like that:

...
Networking.get(url: url) { result in
    ...handle result here...
    CFRunLoopStop(CFRunLoopGetCurrent())
}

CFRunLoopRun()
print("Ended OK")
amadeu01 commented 3 years ago

@mkll thanks!