You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
755 B
29 lines
755 B
//
|
|
// Preferences.swift
|
|
// Notes
|
|
//
|
|
// Created by Laurent Morvillier on 04/09/2022.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
class Preferences {
|
|
|
|
static func store(filename: String, content: String) {
|
|
UserDefaults.standard.set(content, forKey: filename)
|
|
Preferences._fileChanged(filename: filename)
|
|
}
|
|
|
|
fileprivate static func _fileChanged(filename: String) {
|
|
UserDefaults.standard.set(Date(), forKey: filename + "_date")
|
|
}
|
|
|
|
static func getContent(filename: String) -> String? {
|
|
return UserDefaults.standard.object(forKey: filename) as? String
|
|
}
|
|
|
|
static func lastEditDate(filename: String) -> Date? {
|
|
return UserDefaults.standard.object(forKey: filename + "_date") as? Date
|
|
}
|
|
|
|
}
|
|
|