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 Object-Oriented Objective-C Tying it All Together Composition


What is the difference and why do you always import the .h Can someone tell me what you code in .h and what you code in .m

1 Answer

Greg Kaleka
Greg Kaleka
39,021 Points

Hi Jack,

My Objective-C is a little rusty, but basically, .h is a header file, where you declare your properties and methods, including their data types, while .m is an implementation file where you actually define what values to put in properties and what functionality to put in methods.

You have to import .h so that the compiler knows what methods and properties you will be implementing.

Hope that helps!

Cheers :beers: