I’m in the process of learning Objective-C and I’ve read that I should be using both bracket notation exclusively and dot notation exclusively. Is there any practical benefit to using one over the other, or is it personal preference?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Dot notation is the current best way to access properties in Objective-C. The arguments for one paradigm or another are largely stylistic, and Apple’s style is dot notation. As an Objective-C beginner, you should always strive to emulate Apple’s style. Whoever told you to exclusively use bracket notation is incorrect.
And, though you didn’t ask this I’m going to mention it here because it’s a perpetual source of confusion for people just learning Obj-C. The following setters are identical
the following getters are identical