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 Objective-C Basics (Retired) Introduction to Objective-C From Structs to Objects

Rodrigo Chousal
Rodrigo Chousal
16,009 Points

.m and .h

If I understood this correctly, you declare something like functions in the .m file. In the .h file you actually specify what that function is supposed to do.

Am I getting this correctly? If I am, could you please give me a more thorough explanation?

1 Answer

Patrick Serrano
Patrick Serrano
13,834 Points

You have that backwards, and a little too vague.

The .h file is where you declare the "public" facing parts of the class (Both methods and properties). These are the parts that another class would be able to access.

The .m is where you actually write the methods, and is also where you would declare any "private" interface.