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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:17:08+00:00 2026-05-31T19:17:08+00:00

Like most, I recently downloaded the latest version of XCode (4.3.1). I’ve noticed that

  • 0

Like most, I recently downloaded the latest version of XCode (4.3.1). I’ve noticed that as I’m creating new UIViewController objects, the associated .m files contain additional class definition code that I haven’t ever seen before.

Specifically, if I create a new UIViewController named ‘TestViewController’, I get the following .m file output.

\\... removed comments...
#import "TestViewController.h"

@interface TestViewController ()

@end

@implementation TestViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

\etc…

The newly added code since XCode 4.3 is the portion under the #import statement:

@interface TestViewController ()

@end

What is the purpose this code? Can/should anything go within the parenthesis? Should any code go within the @interface and @end statements?

In short, what was the point of adding this code to the template? As an interesting side note, when I tried creating an NSObject from a template, the above mentioned snippet of code wasn’t added. It might appear with other types class templates but at the moment I’ve only encountered it with UIViewController and UITableViewController objects.

  • 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-31T19:17:09+00:00Added an answer on May 31, 2026 at 7:17 pm

    That is an Objective-C class extension. It’s used to define “private” variables, properties, and methods.

    The idea is that the .h file should only contain publicly accessible properties and methods. Very often, when writing a view controller, there are methods that you will want/need to write, but these methods shouldn’t be publicly visible (i.e., these methods should only be used in your .m file). You declare these methods in the class extension to keep it out of the public .h interface.

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

Sidebar

Related Questions

So like most new .NET developers you start of passing DataSets everywhere and although
It appear that SQL Server like most other products Random Function really is not
I have a particular web application that like most others, has to account for
I would like to create a thread pool which will execute the most recently
What would be the best way to implement a most-recently-used cache of objects? Here
I would like to find the most recently changed file in a directory, excluding
Like most *nix people, I tend to play with my tools and get them
Like most developers, I'm a business developer, which in essence consists of slapping a
Like most developers here and in the entire world, I have been developing software
Like most people, I learnt C++ after C. I learnt C++ because it was

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.