Equivalent android.content.BroadcastReceiver in Sw

2020-07-04 13:20发布

问题:

I would like to know if there is an equivalent android.content.BroadcastReceiver in Swift. I would need the same handler like onReceive(Context context, Intent intent)

It is possible ?

Thank you

Ysee

回答1:

In Swift in order to achieve the same effect you would use the NSNotificationCenter. Take a look at this link below for some guidance

http://www.andrewcbancroft.com/2014/10/08/fundamentals-of-nsnotificationcenter-in-swift/