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 trial

iOS

What is a "Model"?

Maybe it's a little dump, but i don't remember what's a Model. It refers to an object, as a Class or Struct?

A data model represents the structure of information in an app. Apple offers a little more information on that in their tutorial

1 Answer

Hi Iván Martínez, imagine that you have an app that allows users to sign up and view others profiles. This apps data model consists of a class or struct called User which defines a Blueprint for a user like so:

struct User {
    var id: String
    var username: String
    var email: String
    var password: String
    var profileImage: UIImage
}

If you reffer to the model layer of your app, you always mean something like this struct. I hope this helps :) Let me know if you have any further questions.

This helped me a lot, thank you!