Objective-C best practices [duplicate] - objective-c

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
What are best practices that you use when writing Objective-C and Cocoa?
Does anybody know a good reference about Objective-C/Cocoa Best Practices?
Project organization, methodologies, naming and etc.

See question
What are best practices that you use when writing Objective-C and Cocoa?

A great "K&R" style reference for objective-c is Programming in Objective C by Stephen G. Kochan.

As for versioning, definitely set up a version control system. I wrote a tutorial on that here.

Related

Should we build our native SDK using Swift or Objective-C and are there any SDK's out there entirely built on Swift? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
My company is currently planning on providing our services and UI components in the form of native SDK. What are pros and cons of building the SDK in Swift vs Objective-C?
Note: Our clients who will be integrating our SDK will be either using Swift or Objective-C.
I would highly encourage watching this talk by Jonathan Blocksom: http://realm.io/news/swift-objc-best-friends-forever/
It says:
"Swift and Objective-C work together fairly well, so there are many reasons why you would want to include both in a single project. There may be a handy Swift library that you want to use in Objective-C, or vice versa. If you have a big Obj-C codebase and you want to learn Swift, now would be a good time to do that as well. Swift was built for Objective-C compatibility and also works with C, but not with C++. Many types in Objective-C translate over to Swift fairly well: BOOL to Bool, NSInteger to Int, SEL to Selector, and so on."
In my limited experience, using Objective-C code from Swift is a more common use-case and fairly trivial. Using Swift code from Objective-C is certainly possible, but it has some gotchas: Specifically, check "Alamofire in Obj-C Case Study" in the video.
Alamofire is an HTTP networking library written in Swift, from the creator of AFNetworking: https://github.com/Alamofire/Alamofire
Also, I would encourage you to read the official document: https://itunes.apple.com/us/book/using-swift-cocoa-objective/id888894773?mt=11
I hope that helps.

Should I learn Swift or Objective C for iOS [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I've just learnt objective c for the purpose of app building for iOS. In fact i started tinkering this week with my first attempt at an app, I was unaware about Swift and I am reading the text blog on the WWDC.
Going forward, should I be looking to build apps in Swift rather than Objective C now? And are the languages fairly similar?
I ask mainly because I've only just learnt the syntax for Objective-C and done little playing around with it, so dropping it all together isn't too much of a big deal for me. What's more important is that I use the right language. I got my first mac only a few months ago and I've not had much experience with Apple so I thought I'd go to place where people who are far more experienced all round could help point me in the right direction. I don't know if Swift means that it's likely Objective-C will be dropped entirely at some point.
This answer won't stand the test of time, but as of today:
Objective-C will be around and supported for a long time. (Apple has a massive amount of Objective-C source code that it's not going to port to Swift any time soon.)
Almost all iOS tutorials, examples, and books use Objective-C.
Almost all iOS-specific third-party source code you might want to use is implemented in Objective-C.
It's easier to use C and C++ libraries from Objective-C than from Swift.
There are many Objective-C experts you can get help from. There are very few Swift experts.
The Swift language and its standard library are currently not very well documented.
Stick with Objective-C for now. When you're comfortable with the iOS SDK and Swift is better documented, you can consider learning Swift.
UPDATE
It's been four months and my opinion on this hasn't changed. If you're looking for a more recent answer, this Hacker News thread was asked and answered today: Is Swift ready for production?

First language for iOS? Rubymotion vs C, Objective C vs others [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have no coding experience except for some basic VBA programming to help out my financial models (read: I have 0 coding experience or background). However, I would love to start developing for the iOS or OSX as a hobby and maybe take it further later on.
For the past day or two, I've been researching the best first lanaguge to learn. Should I go directly to C and then Objective C or should I learn something more high level like Ruby and Rubymotion? I'm open to all sorts of suggestions.
Thanks!
If you're looking to go straight into iOS, you might as well go directly into Objective C. Objective C is different enough from pretty much any other "common" language (Java, C#, VB, etc) that knowing another language won't really help you. You should, however, know the basic concepts that encapsulate all programming.
If you're looking at learning to code for iOS to do mobile apps, the following courses through iTunes could be of considerable help to you. They're from Stanford University, and are free.
https://itunes.apple.com/us/course/coding-together-developing/id593208016?l=en
https://itunes.apple.com/us/course/developing-ios-7-apps-for/id733644550
There are two things you will need to learn in order to develop iOS apps: how to program, in general, and how the iOS SDK (software development kit) works in particular.
Learning the iOS SDK is a “fixed cost” that doesn’t have anything to do with which programming language you choose. You’re going to have to know that (for example) if you want to display an alert to the user you’ll have to instantiate a UIAlertView object and set some properties on it. That is the case regardless of the programming language.
Since almost all of the existent example code for iOS is written in Objective-C, however, you’ll be best served learning that language to begin with. Objective-C is a fine candidate for your first language, so taken together the “learn to program” and “learn the SDK” tasks will be easiest if you start by learning Objective-C.
(For what it’s worth I’d recommend Aaron Hillegass’s iOS Programming: The Big Nerd Ranch Guide, but of course there are tons of free and paid ways to learn Objective-C and Cocoa.)

How does automatic Reference Counting in Objective C works? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How does the new automatic reference counting mechanism work?
Can someone explain succinctly how automatic Reference Counting in Objective C works?
It's not a quick "type it up for the internet" answer. There was a nice hour-long lecture about it at WWDC 2011 that was dense with information.
Suffice it to say that the next step in compiler technology and code analysis is at the heart of how it works.

Good resources for learning Objective-C [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
This question's answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions.
I have developed for a number of years in Java, primarily for Linux and Windows. During my undergrad and grad school times, I also did quite a bit in C and C++. I have recently (in the last year and a half) started using primarily Apple computers at home, and am interested in exploring their Xcode development environment. I am interested in learning how to use the Cocoa interface, etc. However, I know nothing (or next to nothing) about Objective-C. I am aware it is a pure superset of C, however I am interested in some resources for learning it.
In the past, to teach myself concepts of Swing for Java, I have used O'Reilly books, such as the Swing Bible, Java Swing by Marc Loy et. al. Is there a similar book for Objective-C, or a book that is really good to learn from? I would prefer if it was fairly technical, had examples, etc. Has anyone else attempted to learn Objective-C this way? Are there any specific things I should look at?
Just to note, yes I do have K&R, I have read it too many times to count, and I am aware of C syntax. It has been a while, but I do remember large amounts of it. :) I did see this question, but I did not see any particular resources mentioned, simply some general statements about learning.
Thanks!
Concepts in Objective-C Programming and Cocoa Core Compentencies - Apple's official basic documentation for the language and the Cocoa framework.
Cocoa Programming for Mac OS X - The definitive book for Cocoa newcomers. It's actually focused on the Cocoa frameworks more than Objective-C, but still invaluable.
Programming in Objective-C 2.0 - Focuses on Objective-C itself more than Cocoa; may have more basic information than an experienced programmer would need, but covers plenty of good stuff.
The "Language" part of Matt Neuberg's Programming iOS 6 covers Objective-C itself in detail.
CocoaDevCentral - Excellent tutorials. Start with the "Learn ..." and "Objective-C Style" tutorials.
Stanford's free CS193E and CS193P courses
CocoaHeads.org - A large list of resources (books, website, and code) about Cocoa/Objective-C.
HyperJeff's Cocoa Literature List - A huge compendium of useful information, etc.
Cocoa With Love - An excellent blog with specific, useful snippets and in-depth explanation.
Cocoa Is My Girlfriend - A fun and useful blog (usually) about Cocoa.
Best Practices for Cocoa Programmers (by Aaron Hillegass) - A bit dated, but contains some nuggets and guidelines for understanding and following Objective-C/Cocoa conventions
CocoaDev.com wiki - Especially good for specific questions about a specific class or task. (Undergoing updates.)