1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| enum FyAppObserverName:String{ case isLogin = "isLogin" case isVip = "isVip" case timeLength = "timeLength" }
class FyAppStatusManger:NSObject{ static let shared = FyAppStatusManger.init() var valueChanged:((_ observerName:FyAppObserverName,_ oldValue:Any?,_ newValue:Any?) ->())? override init(){ super.init() } var isLogin:Bool = false{ didSet{ valueChanged?(.isLogin, oldValue, isLogin) } } var isVip:Bool = false{ didSet{ valueChanged?(.isVip, oldValue, isLogin) } } var timeLength:Int = 0{ didSet{ valueChanged?(.timeLength, oldValue, isLogin) } } }
|