发布于 1年前

Swift 3/4获取AppDelegate实例的引用

Swift 3/4获取AppDelegate实例:

func appDelegate() -> AppDelegate{
    return UIApplication.shared.delegate as! AppDelegate
}

对于Swift < 3

func appDelegate() -> AppDelegate{
    return UIApplication.sharedApplication().delegate as! AppDelegate
}
©2020 edoou.com   京ICP备16001874号-3