IOS_Boss/IOS_study/Auth/AuthViewModel.swift
2025-07-27 12:33:06 +08:00

30 lines
764 B
Swift

//
// AuthViewModel.swift
// IOS_study
//
// Created by CC-star on 2025/7/15.
//
import Foundation
import LeanCloud
@Observable final class AuthViewModel {
var isLogin = LCApplication.default.currentUser != nil
init() {
NotificationCenter.default.addObserver(self, selector: #selector(handleLogin), name: .loginSuccess, object: nil)//,nil
NotificationCenter.default.addObserver(self, selector: #selector(handlelogout), name: .logoutSuccess, object: nil)
}
@objc func handleLogin() {
isLogin = true
}
@objc func handlelogout() {
isLogin = false
}
deinit {//
NotificationCenter.default.removeObserver(self)
}
}