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 From Structs to Objects

objective C is confusing

C I was able to understand, sort of. Objective C I'm not understanding at all.

It seems like with C, Treehouse started at the beginning. But with objective C it's like they started in the middle. I'm just lost.

4 Answers

Thomas Nilsen
Thomas Nilsen
14,957 Points

It takes time. I came from C/C++ too. The best way to get used to it, is to just code something. Anything. It doesn't have to be anything complicated. Do that as well as tutorials and before you know it you'll get the hang of it. :)

Brett Doffing
Brett Doffing
4,978 Points

I wonder if it is not simply object oriented programming concepts that seem to be confusing? There is a lot to learn in using Objective-C, and Xcode, but in learning how to use these concepts and tools, in my experience, other languages and tools become easier to pick up on.

Well good new! Swift is a new programming language that Apple has released and it is VERY easy. I haven't got to mess it too much yet though since i'm about to release my first game to the App Store but from what I have so far, it's easy. It's supposedly 2.9x faster than Objective-C (not really sure where or how, just what apple claims) and supposedly more error proof (again, according to apple) and seems to be the way everyone will be going. Sadly if you aren't a registered developer you can't use as it requires Xcode 6 which is still in beta. It doesn't mean give up Objective-C though and you can use them in the same project side by side. Anyways, check Swift out, seems pretty amazing.

Patrick Serrano
Patrick Serrano
13,834 Points

My understanding is that Swift is faster because it sits onto of objective-c and by design can make assumptions about what your code will or will not be doing. That allows the compiler to make optimizations that it otherwise wouldn't be able to.

My understanding about the safety aspect is that it is also very closely related to the speed. Swift eliminates pointers when writing your code, and instead that is handled by the compiler. As a result you are no longer able to send messages to deallocated objects, thus making the code your write safer. (Since the compiler doesn't have to worry about you sending messages to deallocated objects, it can make assumptions and optimizations to make your code faster)

Treehouse in a blog post mentions how Swift may be deceptively easy to learn for the following reasons:

  • Closures
  • Tuples and multiple return values
  • Generics
  • Enums and Structs
  • Optional chaining

The post goes on to say, "After glancing through the [Swift] book I believe that on some levels Swift may be harder to learn because of the advanced features mentioned above."

Awesome info guys. Just talking about it makes me want to drop this game and jump right in. That's a good point about the difficulty though and maybe true. Either way it's supposedly more for "beginners" but I guess I got carried away as it has so many helpful things that make my life easier, like 1/2 the code, switch statements actually worth using. I could go on forever but I realize we are getting off subject here a little now. Anyways man, just stay at it. It wasn't long ago that there wasn't much that I knew about it. If you don't understand something, just try to take most of it in and just go through the motions. Learning this stuff comes from lots of repetition and then try to put what you have learned (or tried to) into a project. You'll quickly find what you didn't get a full grasp of and then just go back and review and never forget apples documentation which was something I overlooked even though teachers stressed it. It's easy to understand when you get the hang of it, well sometimes lol.