As Paul Hudson, a Swift Community Builder said on one of his tutorials:
"Notice the way we call
resume() on the task straight away? That’s the gotcha – that’s the thing you’ll forget time and time again. Without it the request does nothing and you’ll be staring at a blank screen. But with it the request starts immediately, and control gets handed over to the system – it will automatically run in the background, and won’t be destroyed even after our method ends."
Why we can't just have a small warning when the user builds the code if he/she didn't use the .resume() on a URLSession task?
"If you want your task to run immediately, don't forget to add .resume() on the end of your task declaration."