• 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: With What does Apple Swizzle the IsA-pointer in KVO?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: With What does Apple Swizzle the IsA-pointer in KVO?


  • Subject: Re: With What does Apple Swizzle the IsA-pointer in KVO?
  • From: Philip Mötteli <email@hidden>
  • Date: Fri, 23 Nov 2007 19:09:15 +0100

Am 23.11.2007 um 18:05 schrieb Clark Cox:
On Nov 23, 2007 8:03 AM, Philip Mötteli <email@hidden> wrote:
Am 23.11.2007 um 15:54 schrieb Clark Cox:
On Nov 23, 2007 5:42 AM, Philip Mötteli <email@hidden>
wrote:

Apple says, that it uses IsA-swizzling as the underlying technology
to
implement KVO.
What are/is the class(es), which replace the original class of the
observed object? Is it an NSProxy subclass? Different NSProxy
subclasses, depending on the observed object? Is it a direct subclass
of the observed object?


Perhaps I could provide more help if you
stated why it is that you think that you need to know this.

I need to know, when an object has changed and I would prefer to reuse
as much as possible, of what KVO already offers.
Unfortunately, KVO is based on the internals of an object (which
should be assumed as being hidden in OOP).

KVC (and by extension, KVO) only uses instance variable directly if: 1) There is no appropriate accessor method 2) +accessInstanceVariablesDirectly is not implemented to return NO

I have a problem.
Ideally, I just want to implement a plug-in, that reuses the
functionality, offered by KVO, but extends it, so that the publicly
accessible part of an object can be observed instead of the hidden
internals.

The publicly accessible parts of objects *are* what is observed.
What is the difference between:

- (void)setValue:(id)value forKey:(NSString *)key

and

OBJC_EXPORT void object_setIvar(id obj, Ivar ivar, id value)




In both versions, you have violated, what Apple writes in

Attachment: Object-Oriented Programming with Objective-C- Classes.webloc
Description: application/applefile

:

An object’s data is protected and won’t be touched by any other part of the program. Methods can therefore trust its integrity. They can be sure that external access hasn’t put it in an illogical or untenable state.

So yes, in my eyes, KVC violates OO principles (except, when it uses a publicly declared accessor).






I'm still not clear as to what you're trying to do. NSString is not
mutable, so attempting to observe one of it's properties doesn't make
sense,

Yes, bad example. Take NSMutableString or NSMutableRLEArray, NSMutableAttributedString, NSAttributedString, NSMutableCharacterSet,…



and finalize and dealloc are just methods, what would observing
them even mean?

That your object has disappeared, which is also a kind of changement.

But Clarc, tell me, do you know the answer to my initial question:
With What does Apple Swizzle the IsA-pointer in KVO?


Then, please tell me.

_______________________________________________

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: 
 >With What does Apple Swizzle the IsA-pointer in KVO? (From: Philip Mötteli <email@hidden>)
 >Re: With What does Apple Swizzle the IsA-pointer in KVO? (From: "Clark Cox" <email@hidden>)
 >Re: With What does Apple Swizzle the IsA-pointer in KVO? (From: Philip Mötteli <email@hidden>)
 >Re: With What does Apple Swizzle the IsA-pointer in KVO? (From: "Clark Cox" <email@hidden>)

  • Prev by Date: Re: With What does Apple Swizzle the IsA-pointer in KVO?
  • Next by Date: Re: With What does Apple Swizzle the IsA-pointer in KVO?
  • Previous by thread: Re: With What does Apple Swizzle the IsA-pointer in KVO?
  • Next by thread: Large progress indicators in Leopard
  • Index(es):
    • Date
    • Thread