• 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: Objective-C question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Objective-C question (From: Chuck Soper <email@hidden>)
 >Re: Objective-C question (From: Fritz Anderson <email@hidden>)
 >Re: Objective-C question (From: Chuck Soper <email@hidden>)
 >Re: Objective-C question (From: j o a r <email@hidden>)
 >Re: Objective-C question (From: Scott Thompson <email@hidden>)
 >Re: Objective-C question (From: Ondra Cada <email@hidden>)
 >Re: Objective-C question (From: Scott Thompson <email@hidden>)
 >Re: Objective-C question (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Network Address in Cocoa
  • Next by Date: Another NSText... problem: a sticky attribute
  • Previous by thread: Re: Objective-C question
  • Next by thread: Re: Objective-C question
  • Index(es):
    • Date
    • Thread