如何在Sierra使用NSNotificationCenter

时间:2016-10-24 00:48:01

标签: swift3 nsnotificationcenter

我目前正在为macOS学习Swift,需要使用NSNotificationCenter。在文档中,据说我可以使用该类:

NSNotificationCenter documentation said that I can use it for macOS Sierra

然而,Xcode似乎并没有认识到这个类:

Xcode doesn't recognize NSNotificationCenter

是否有一些步骤丢失了?因为,我觉得基础课不需要导入。

1 个答案:

答案 0 :(得分:3)

在swift 3中,它已更改为NotificationCenter。

编辑:这是关于如何使用它的example 我不知道为什么它不会出现在你的Xcode上,它可能是一个错误。