1. 获取Appdelegate
let myAppdelegate = UIApplication.shared.delegate as! AppDelegate
2. 获取Appdelegate的属性
if myAppdelegate.xx != nil
{
xx = myAppdelegate.xx
}
let myAppdelegate = UIApplication.shared.delegate as! AppDelegate
if myAppdelegate.xx != nil
{
xx = myAppdelegate.xx
}
本文标题:Swift - 在其它类获取Appdelegate单例的属性或对
本文链接:https://www.haomeiwen.com/subject/iivnsxtx.html
网友评论