• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
re:[newbie] Cyclic #import
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re:[newbie] Cyclic #import


  • Subject: re:[newbie] Cyclic #import
  • From: Christopher Drum <email@hidden>
  • Date: Tue, 7 Dec 2004 21:46:22 -0800

Seems to me that what you are looking for in this case is "@class".
Remember, you don't necessarily need to #import the full header file for a custom class. In your example, you simply need to declare it.

So, instead of...
#import <Cocoa/Cocoa.h>
#import "MyNetworker.h"

@interface MyController : NSObject
{
IBOutlet MyNetworker * networker;
}

you would write something like this...


#import <Cocoa/Cocoa.h>
@class MyNetworker;

@interface MyController : NSObject
{
IBOutlet MyNetworker *networker;
}

Now, the MyNetworker class is understood enough to reference your instance variable without getting into the cyclic nature of the multiple #imports. Plus, since you're not importing the full .h file, your builds should be a little faster (depending upon the length and complexity of such).

Hope this helps!

------------------------------------------------------------------
Christopher Drum
http://homepage.mac.com/christopherdrum

Check out FileWrangler, my five-star rated (MacUpdate, VersionTracker) Cocoa app written in Objective-C for the batch renaming of files.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: [newbie] Cyclic #import
      • From: Sherm Pendley <email@hidden>
  • Prev by Date: Re: Creating a Class Instance By Name
  • Next by Date: Drag and drop color swatches
  • Previous by thread: Re: [newbie] Cyclic #import
  • Next by thread: Re: [newbie] Cyclic #import
  • Index(es):
    • Date
    • Thread