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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:15:21+00:00 2026-05-26T15:15:21+00:00

I am seriously confused about the Objective-C #import. I searched and found several tutorials

  • 0

I am seriously confused about the Objective-C #import.

I searched and found several tutorials saying that if I have lots of constraints like

#define val1 
#define val100

it’s better to put all constraints in one file and import this file for reusing all values.

But i am still confused, I saw many code samples which #import all other files’ headers in which there is is no

#define constraints 

These two files are normal UIViewControllers, but their headers are imported.

#import viewcontroler1.h 
#import viewcontroler2.h 
  1. When can we simply create objects of classes why import them?
  2. Where to import files in .h or .m?
  3. What to import, the .h or the .m file in Objective-C?

I am seriously confused, please help me.

  • 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-26T15:15:22+00:00Added an answer on May 26, 2026 at 3:15 pm

    I’m not sure I’m really understanding what you’re asking for, but you should avoid importing header files in other header files, if you don’t need to. Instead, #import the headers you need in the .m file and use the @classdirective in your .h files instead.

    From the Apple docs:

    The @class directive minimizes the amount of code seen by the compiler
    and linker, and is therefore the simplest way to give a forward
    declaration of a class name. Being simple, it avoids potential
    problems that may come with importing files that import still other
    files. For example, if one class declares a statically typed instance
    variable of another class, and their two interface files import each
    other, neither class may compile correctly.

    Otherwise, you might be exposing your imported variables to more classes than you actually need. If you’re importing your constants.h in viewcontroler1.h, any other class importing viewcontroler1.h will also have constants.h. Sometimes this might be what you need, but it usually isn’t.

    Hope that helped in some aspect…

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

Sidebar

Related Questions

I'm seriously confused about the concept of the 'Model' in MVC. Most frameworks that
Seriously I'm confused. I have an .XSD that is made from a class so
I'm seriously stuck here with something obvious. I have an application that communicates with
Like seriously after going through this... Easy way to dismiss keyboard? ... I have
Seriously, it seems like every time I want to make my UI elements talk
I have been seriously disappointed with WPF validation system. Anyway! How can I validate
Not that it is seriously burdensome to type :My_custom_foobar() instead of just :my_custom_foobar() but
i am seriously struggling to get my head around regex. I have a sring
maybe i am wrong but i seriously i don't like the current structure of
I'm working on catching a seriously insidious bug that's happening in my code. The

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.