개발/아이오에스
[IOS] Date 사용해서 하루(24시간)경과 체크하기
dev.jake
2022. 12. 12. 14:17
UserDefaults.standard.set(Date(), forKey:"creationTime1")
if let date = UserDefaults.standard.object(forKey: "creationTime1") as? Date {
if let diff = Calendar.current.dateComponents([.hour], from: date, to: Date()).hour, diff > 24 {
keys.setNewTokenValue()
}
}