deinit

    /*deinit属于析构函数

     析构函数(destructor) 与构造函数相反,当对象结束其生命周期时(例如对象所在的函数已调用完毕),系统自动执行析构函数,和OC中的dealloc 一样的,通常在deinit和dealloc中需要执行的操作有:

     对象销毁

     KVO移除

     移除通知

     NSTimer销毁

     */

    deinit {

        // 注销通知 - 注销指定的通知

        NotificationCenter.default.removeObserver(self,name: NSNotification.Name(rawValue: kUserDidLogin),object: nil)

    }

    

posted @ 2017-12-07 14:27  王彬iOS  阅读(839)  评论(0编辑  收藏  举报