Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6067679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:38:02+00:00 2026-05-23T09:38:02+00:00

Do change notifications cascade with KVO down to their properties or is there any

  • 0

Do change notifications cascade with KVO down to their properties or is there any elegant way that does not include implementing it manually by simply observing both parent and child changes?

Let’s assume we have a User class and a Document class. One user can have any amount of documents. Now let’s assume I have a view controller displaying details about a document and let’s also assume I somewhere store a variable called currentUser. If I now observe one document object that belongs to that one user who is also the value of currentUser and I change the currentUser to another user, will the change notification “cascade” down to to that view controller who is only observing the document object that belonged to the previous “currentUser”?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:38:03+00:00Added an answer on May 23, 2026 at 9:38 am

    An observer only receives notifications about (specific) properties of (specific) objects it is actually observing. It does not receive notifications about any other changes.

    If I understand your description correctly, the observer is observing properties on one particular document object. The observer is not observing the currentUser property (which is part of another object). So no, the observer definitely will not get a notification if currentUser changes.

    It is, however, possible in KVO to trigger a change notification for properties that are affected by the change of another property. This is typically used for computed properties:

    Imagine a class Event that has a read/write property startDate and endDate, and a computed property duration that calculates the duration based on start and end date:

    - (NSTimeInterval)duration
    {
        return [[self endDate] timeIntervalSinceDate:[self startDate]];
    }
    

    You would set up this class so that it notifies observers of duration when someone modifies startDate or endDate:

    + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key
    {
        NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key];
    
        if ([key isEqualToString:@"duration"]) {
    
            keyPaths = [keyPaths setByAddingObjectsFromSet:
                [NSSet setWithObjects:@"startDate", @"endDate", nil]
            ];
    
        }
    
        return keyPaths;
    }
    

    This is described in more detail in the Key-Value Observing Programming Guide.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ist there a way to get a change notification if an attached property changed?
Is there a way to get notification of date change in c#? I have
change() function works and detects changes on form elements, but is there a way
Is there a way to programmatically change the sound settings of Windows Phone 7?
How do you change the sound that plays for local notifications? I use the
How to hook to the property value change notification for properties of a FrameworkElement?
Change all links that have an image in it to: javascript(alert(thehref)); eg. <a href=/galleries/anna-leah-111827/image01.html><img
I have created a stored procedure GetNotifications that returns all notifications for a specific
I have an app that subscribes to a specific kind of notifications from the
Following linq statement generates multiple trips to the database, is there a way to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.