Discussion in 'iOS Programming' started by grandM, Apr 12, 2017.

  1. grandM macrumors 6502a


    Oct 14, 2013
    Hi guys

    I'm having some problems with MVVM. So MVVM has a ViewModel. This ViewModel is fabricated out of the Model thinking of the View. That's clear.

    Question remains if you instantiate the objects (needed for the View) in the Controller or in the ViewModel?

  2. Mascots, Apr 12, 2017
    Last edited: Apr 14, 2017

    Mascots macrumors 65816


    Sep 5, 2009
    There really isn't a solid set of rules to abide by, but if the object you initiate is a component of the view, it probably belongs in the controller. If the object is just providing information for the view (content, view configuration), it should probably be in the View Model object.

Share This Page