Group Group Group Group Group Group Group Group Group

Networking with URLSession · Uploading Data |


This is a companion discussion topic for the original entry at


Hi @bdmoakley,

Out of curiosity, what’s the litmus test to decide whether to use the shared singleton vs a full blown session object when prepping for a URLSession operation? Also, in this case we set the delegate up on the main operation queue. When might we want to use a different queue, and why?



Deciding to use a singleton vs. a full session is really a use case decision (in my opinion). If was doing a simple request where I needed just to make a request, then I’d use the singleton but anything more than that, I’d use an object. That said, I know developers who refuse to use singletons unless they actually have to use it.

As for different queues, you may want to set up dependencies, For instance, you may want to download some information, process it, then upload it to a different service. Doing this in a background queue won’t affect the user interface at all. I hope that helps!


It does indeed! Much obliged!


Why is it necessary to deal with Python? Is it because Flask needs it? Or would every upload need this Python step?


I found this to be the easiest way to setup a server to show uploading. I didn’t want to provide too many steps where you’d be focusing on the server setup vs. the actual uploading. You can use any server technology you want.


So in conclusion the Python steps are necessary because Flask is set up to use it? So not every server needs a bit of Python work? Or do I have it wrong? Thx for your answer.


Hey there, Python is absolutely not necessary to create a server. I only used Python to create a Flask server because it took very little code to do. You could have just as easily used a server written in Swift or C# or even plain old C. SO to answer your question, python is not necessary.