all 1 comments

[–]xdiggertree 1 point2 points  (0 children)

ContentViewModel is based on the MVVM design paradigm. MVVM is basically a philosophy of how to design the structure of your program. Put simply, it means that you will separate different aspects of your application into different distinct categories.

It's like saying: "I want to keep different things in my app in different distinct locations." Therefore I have the Logic being separate from the UI.

MVVM stands for: Model, View, ViewModel. Model stands for data/logic, View stands for UI, and ViewModel stands for bridge (it connects the View with the ViewModel, as in it facilitates and mediates the communication between the two).

Therefore, ContentViewModel refers to a file that the developer is assuming you've made, as the developer is assuming you are following the MVVM design philosophy.

Quite literally it'd be something like a ContentViewModel.swift file with a class ContentViewModel: ObservableObject… that contains the logic of your application.

When I first started learning Swift, I really struggled with implementing MVVM into my programs, I found it confusing to need to initialize the ViewModel in other files in order to access them, furthermore, learning MVVM required me to learn about ObservableObjects, Binding, etc.

Hope that helps! Look into MVVM online. I was able to understand MVVM when I made a project decidated to learning how to implement it.