For dispatch, you want to use dispatchMain. That will start the loop which waits and executes blocks on the main queue. Note that it never returns - it will keep looping and waiting forever - so you need to exit the program another way.
import Foundation
print("Beginning")
DispatchQueue.main.asyncAfter(deadline: .now() + 4) {
print("async")
exit(0) // <- POSIX 'exit' function will close the program
}
dispatchMain() // <- This function never returns.
You're welcome! And that's right; non-zero codes typically denote failure.
See the notes on the manpage about exit codes. They suggest using EXIT_SUCCESS and EXIT_FAILURE (which are imported in to Swift) for maximum portability. I probably should have done that