Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAndrei Li
34,475 Pointsmodel and view Model - where they are coming from? I haven't found any reference in the project files.Are they built in?
So they should be in UIKit? Or I am missing something. Help is needed! Please. I tried to Google but all links are about MVC.
1 Answer
Nathan F.
30,773 Points"Model" and "View Model" aren't components of UIKit, rather, they're terms used in object-oriented programming to describe a kind of class or type. In this project, CurrentWeather
is our model, and in this video Pasan builds a class called CurrentWeatherViewModel
which takes an instance of CurrentWeather
.
A 'model' is a very typical usage of a class. A Person
, Car
, Movie
, or Book
would all be examples of models. They describe what an object is, and what sorts of properties it has. A 'view model' tells our app how it should display the data we have.