NSNotificationCenter vs delegation( using protocols )?

前端 未结 6 640
天涯浪人
天涯浪人 2020-11-27 10:56

What are the pros and cons of each of them?
Where should I use them specifically?

6条回答
  •  醉话见心
    2020-11-27 11:24

    Notifications are generally better for notifying the UI of changes the occur on other threads as well. Apple's documentation strongly discourages the use of delegates across threads where possible, both for stability and performance reasons. On the Mac, they suggest using Bindings, but since they don't exist on the iPhone, notifications are probably your next best bet.

提交回复
热议问题