AlDente-macbook-salva-batteria/AlDente/PersistanceManager.swift

30 lines
834 B
Swift
Raw Normal View History

2021-02-14 22:01:54 +01:00
//
// PersistanceManager.swift
// AlDente
//
// Created by David Wernhart on 07.02.21.
// Copyright © 2021 David Wernhart. All rights reserved.
//
import Foundation
class PersistanceManager{
static let instance = PersistanceManager()
public var launchOnLogin: Bool?
public var chargeVal: Int?
public var oldKey: Bool = false
public func load(){
launchOnLogin = UserDefaults.standard.bool(forKey: "launchOnLogin")
oldKey = UserDefaults.standard.bool(forKey: "oldKey")
chargeVal = UserDefaults.standard.integer(forKey: "chargeVal")
}
public func save(){
UserDefaults.standard.set(launchOnLogin, forKey: "launchOnLogin")
UserDefaults.standard.set(chargeVal, forKey: "chargeVal")
UserDefaults.standard.set(oldKey, forKey: "oldKey")
}
}