Search code examples
iosswiftbroadcastreceiver

Equivalent android.content.BroadcastReceiver in Swift


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


Solution

  • 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/