Hi Oswald, thanks for writing.

What we inject in the view hierarchy is not a view model. It is a service: we could have a generator that fetches data from an external service for example.

And yes, we do want to have an abstraction for it, otherwise we won't be able to test it.

the @Published property wrapper is just a way to let other objects consume the output of the computation, but it does not make the Generator a ViewModel.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Riccardo Cipolleschi
Riccardo Cipolleschi

Written by Riccardo Cipolleschi

Hey there, I’m Riccardo. Software engineer at Meta. I have a passion for iOS and I love to share my knowledge with others.

No responses yet

Write a response