Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8789209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:20:25+00:00 2026-06-13T22:20:25+00:00

What is the point of using the @private directive in Xcode when you are

  • 0

What is the point of using the @private directive in Xcode when you are working alone or with a team that can access all properties, ivars of an app?

Is there any advantage like memory usage, performance, etc? or is this just a stuff for large teams where one part should not be using stuff that can change in the future?

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:20:29+00:00Added an answer on June 13, 2026 at 10:20 pm

    Using @private in the @interface of a class declaration ensures that no other class has access to the ivars. This is important for encapsulation. And this is just as important for a single developer as it is for a team of dozens of developers.

    Encapsulation ensures you only use the provided API for a class without the need to know how it works internally. Some time down the road you may wish to change the implementation. This should have no effect on any classes already using the class. The aPI won’t change, just its implementation.

    Remember, ivars should only be accessed within the implementation of the given class. No other class should have access to those ivars. Otherwise your code becomes very fragile and difficult to maintain.

    Edit: With modern Objective-C you shouldn’t even have any ivars in the .h file anymore. Move them to the @implementation line where they are guaranteed to be private and no one using the .h file even knows what ivars you have.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know we can't compare 2 floating point values using ==. We can only
I just wanted to know if I can point to class using this implementation:
Can anybody point me in the right direction to get Ninject working with WCF
What's the point using this syntax div.card > div.name What's the difference between this
What is the point of using the ampersand in wxPython? I see it in
what's the point of using ant, maven, and buildr? won't the using build in
Obviously the point of using named constants over magic numbers is for code clarity
What's the point of using : int in the enum declaration as following? public
I don't see the point of using either http://960.gs or http://blueprintcss.org if they enforce
I need to send floating point numbers using a UDP connection to a Qt

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.