Search code examples
iphoneiosxcodedelegation

Nsnotification or delegation?


I just researched the two, and they both seem to be great means of communication, but nsnotification seems a ton easier to deal with. What are situations where you would want to use delegation rather than nsnotification, and nsnotification rather than delegation?


Solution

  • Just a side note: both are great concepts. Notifications are easier to handle - especially it is quite easy to write unmaintainable code when used without thought.

    A good architecture should be able to make it possible to live without them in most of the cases.

    I ve seen a larger iPad project where notifications were used to make up for flaws in the architectural design: was horrible. Code completely unmaintainable after 2 months.

    My experience: they are a very handy tool - use them if the other tools failed