• 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: Can I split an implementation file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I split an implementation file?


  • Subject: Re: Can I split an implementation file?
  • From: Quincey Morris <email@hidden>
  • Date: Thu, 27 Nov 2008 09:35:46 -0800

On Nov 27, 2008, at 09:09, Greg Robertson wrote:

Thanks for the link, one last question (I hope) if I declare foo as a
property and synthesize then I could use a category to override the
foo and setFoo. But I was wondering if I could just skip the
synthesize?

Matt's suggestion is going to produce a compiler warning in MyObj.m (foo and setFoo: are declared but not defined in the class). It sounds like you tried to eliminate the warning by putting a @synthesize in MyObj.m, which happens to solve the compiler warning but kind of obscurifies the whole thing. Try this instead:


@interface MyObj : NSObject{
Foo* _foo;
}
-(void) solveWorldFinancialCrisis;
@end

@interface MyObj (GetSetters)
-(Foo) foo;
-(void) setFoo:(Foo)aFoo;
@end

or declare the category like this if you prefer:

@interface MyObj (GetSetters)
@property Foo foo;
@end

Le 27 nov. 08 à 15:04, Matt Gough a écrit :

Yes, something like this should do you

In file MyObj.h
@interface MyObj : NSObject{
Foo* _foo;
}
-(Foo) foo;
-(void) setFoo:(Foo)aFoo;
-(void) solveWorldFinancialCrisis;

@end;

In file MyObj+GetSetters.m:

#import "MyObj.h"
@implementation MyObj (GetSetters)
-(Foo) foo
{....}

-(void) setFoo:(Foo)aFoo
{....}

@end

In file MyObj.m:

#import "MyObj.h"
@implementation MyObj

-(void) solveWorldFinancialCrisis
{
// Good luck with this one :)
}
@end


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Can I split an implementation file? (From: "Greg Robertson" <email@hidden>)
 >Re: Can I split an implementation file? (From: Matt Gough <email@hidden>)
 >Re: Can I split an implementation file? (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Can I split an implementation file? (From: "Greg Robertson" <email@hidden>)

  • Prev by Date: Re: Can I split an implementation file?
  • Next by Date: Re: Can I split an implementation file?
  • Previous by thread: Re: Can I split an implementation file?
  • Next by thread: Re: Can I split an implementation file?
  • Index(es):
    • Date
    • Thread