Swift中的等效android.content.BroadcastReceiver [英] Equivalent android.content.BroadcastReceiver in Swift

查看:104
本文介绍了Swift中的等效android.content.BroadcastReceiver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道Swift中是否有一个等效的android.content.BroadcastReceiver。
我需要像 onReceive(Context context,Intent intent)

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)

谢谢

Ysee

推荐答案

在Swift中,为了获得相同的效果,您可以使用 NSNotificationCenter 。看看下面的链接以获取一些指导

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/

这篇关于Swift中的等效android.content.BroadcastReceiver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆