Re: Objective-C question
Re: Objective-C question
- Subject: Re: Objective-C question
- From: Steve Sims <email@hidden>
- Date: Wed, 5 May 2004 18:29:23 -0400
On 5 May 2004, at 10:30, Ondra Cada wrote:
My opinion is that if the ivars are to be public by design, then you
actually want a struct, not a class.
I presume you can rig up an example when a struct would be impractical
and yet you need public ivars, but IMHO it would make 0.01 per cent of
0.01 per cent, so in practice we can skip that ;)
Hmmm... I've got a structured data model for my app and wish to have
fast access to data contained within my model, hence structures would
seem to be the way to go. That way I'd avoid using accessor methods to
get hold of data contained within classes. However my data model hooks
up to my UI, and for that I want to use bindings. I also wanted to
make use of KVO and KVV to do some other smart things with my model.
Now I must admit that I did not look into this very deeply, but I could
not work out how to get bindings or KVO to work with structures. I
therefore quickly replaced all my structs with classes containing
public variables and now all my model manipulating code works like a
dream, and I've got a nice mechanism to link to my UI.
Probably not the most elegant solution, but it's working for me...
Steve
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.