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 Build a Diary App Using Core Data Deleting and Updating Data Updating Data

Daniel Popov
Daniel Popov
4,024 Points

Import Modal of header file in View Controller Header File

You touch on this at 1:58. I just wanted to understand more of the reason for this theory...

Ash Furrow
Ash Furrow
Treehouse Guest Teacher

Can you clarify a little bit? You mean import the file in the header file? Usually it's to gain access to protocols defined in headers.

Daniel Popov
Daniel Popov
4,024 Points

I understand why one would generally import header files. In the video called "Updating Data" at around 2 min. You say that "You shouldn't import model header files in the view controller header files." I just wanted to understand a little more about this theory. I'm assuming it has to do with proper MVC structure I just wanted some clarification.

Thanks!

2 Answers

Ash Furrow
STAFF
Ash Furrow
Treehouse Guest Teacher

It's about a matter of scope – when A imports B, and B imports C, then A effectively imports C. We want to avoid that whenever possible.

Daniel Popov
Daniel Popov
4,024 Points

I understand why one would generally import header files. In the video called "Updating Data" at around 2 min. You say that "You shouldn't import model header files in the view controller header files." I just wanted to understand a little more about this theory. I'm assuming it has to do with proper MVC structure I just wanted some clarification.

Thanks!