Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Objective-C Basics (Retired) Introduction to Objective-C Introducing @property

relevant and unrelevant information.

On the video which shows how to change from conventional C code to objective there are some floating windows with cashed previously copied material and it is distracting. In addition, it would be helpful if there would be a split screen, with conventional code on one side and objective on another.

1 Answer

Denis Kiselev
Denis Kiselev
12,737 Points

Actually you replace C-style program with different one in Objective-C. You replace structs and functions with classes/objects with properties and methods. There is no one-to-one direct analogy! Thou should start thinking of it like new entity - object, that combine some data with some ways of treating this data (methods).

Think of properties as publicly accessible fields of a struct. But properties have big advantage: they allow you to completely control getting values from them and setting values into them by usig getter and setter methods - special code that will handle setting value of property and getting value from property. So, if you have programming control over it, you can use any way of actual storing value of property inside your class. For ex: you can have Person class with FirstName, LastName and FullName properties. You can use strings for storage of FirstName and LastName, but for FullName you can simply calculate it via concatenating FirstName and LastName.