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 4052068
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:16:25+00:00 2026-05-20T14:16:25+00:00

What is the best practice approach to private methods in objective-c. That is a

  • 0

What is the best practice approach to private methods in objective-c. That is a method that’s only going to be used the class as a helper method.

In particular what’s not clear to me is:

  1. Is there a need to have the method specified in the header file as private at all? i.e. why not just leave it out of the header file, and
  2. If you can leave it out of the header file, then what is the point of having private methods?
  3. Or is it the case in objective-c there is no such thing as real private methods, in which case is it better just to specify everything in the header file and no bother marking the private at all?

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-05-20T14:16:26+00:00Added an answer on May 20, 2026 at 2:16 pm

    There is no need to specify the method in the public header file. You may want a “private” header file for use by other classes in your module, if the classes in your module are supposed to be “friends”. You could even have a “protected” header file, as Apple does with UIGestureRecognizerSubclass.h for example. It’s all just convention, though, nothing supported by the language itself.

    A private method in Objective-C is just one that is not publicly documented; any method can still be called from anywhere, as long as the caller knows the name of it in order to create the appropriate selector. The advantage of not publicly documenting a method is that you are free to change or remove it without worrying about backwards compatibility. Leaving them out of the header file is one way of not publicly documenting them.

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

Sidebar

Related Questions

Whats the best practice approach to creating a form that is used to both
I'm looking at the best practice approach here. I have a web page that
I know that it is not a good practice to call a method in
I'm debating with myself about the best practice approach to controlling an Aggreate View
The best practice seems to be to use assert for a condition that should
When defining a new class within a project what is the correct/best practice for
Our team is developing RESTFul applications...we are debating the BEST PRACTICE approach. Should 404
Now. I so confuse when use any classes. What is best practice approach to
I have an immutable class with some private fields that are set during the
Is there any Best Practice approach to storing persistent static data for iPhone apps?

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.