in MVVM, ViewModel classes prepare Model data into data structures that are convenient for the view to handle. Often a prepared data structure like this is different from the structure that was fetched from the API.
My question is how to name these view-oriented data structures and where to put them in the folder hierarchy. I am using Swift and SwiftUI.
An example, just to be clear:
I have songs data that I fetch from an API, so I have a struct named “Song”. this is the API struct and it’s parsed automatically from the json.
For displaying the song data I have a different struct that the View Model is populating with formatted “Song” data. should I call it “DisplaySong”? “SongViewModel”? (I heard this idea, but it’s confusing because of the similarity to ViewModel class naming)
and where should I place it in my project? inside ViewModel? inside Model?
I would be happy to see what other developers do, as this is quite a common situation.
Thanks!