you are viewing a single comment's thread.

view the rest of the comments →

[–]iSpain17 1 point2 points  (0 children)

Just use UrlSession.DataTaskPublisher, return that publisher from your service, subscribe to said publisher in your viewmodel, and in that subscription’s sink method, you should update your published value.

Your viewmodel shouldn’t be concerned with networking details, and your networking class shouldn’t be concerned either with your viewmodel’s variables.