Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can pass any object as the <code>object</code> of a notification, but the convention is that the <code>object</code> is the "thing that is doing the notifying" (and you put other relevant state in the <code>userInfo</code> dictionary).</p> <p>The reason why it's mostly <code>self</code> is because usually the object doing the notifying usually wants to reference itself. That way, for example, if you had many <code>Foo</code> objects, and one of them completed a task and sent a notification, anyone observing the notification could just look at <code>object</code> to see which <code>Foo</code> was the one in question. The observer can also choose to observe only notifications from a particular <code>Foo</code> when you follow this scheme. </p> <p>It's also reasonable (though less common) to use something besides "self" when posting a notification-- let's say you're sending a notification "on behalf of" another object. For example, you could be a singleton controller object that completes a <code>Bar</code> task, and you could send the notification with a reference to the particular <code>Bar</code> as the object. That makes more sense than using the singleton as the <code>object</code>, since there'd be no interesting variance there.</p> <p>Again, this is a (useful) convention only. When you make up your own notification, you get to define the "contract" of the notification, which is the name, what kind of object is used as the <code>object</code>, and what's in the <code>userInfo</code>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload