Are objects automatically registered to observe their own key values?

Discussion in 'iOS Programming' started by moonman239, Feb 11, 2014.

  1. moonman239 macrumors 68000

    Joined:
    Mar 27, 2009
  2. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #2
    No.

    Key value observing is fairly costly. Why would an object need to observe itself?
     
  3. moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #3
    So it can notify the object that contains it when a value changes. Yes, I know the containing object can add itself as an observer, but it could end up doing more work than it needs to.
     
  4. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #4
    Sorry, but that's dumb. Notifying yourself, you would then have to generate a second notification to the other object. There is NO value in KVC notification of yourself.
     

Share This Page