nextcloud-desktop/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderConfig.swift
Claudio Cambra f987bcd97a Add computed property to FileProviderConfig to get and set internal config
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2024-03-06 18:46:41 +08:00

34 lines
901 B
Swift

//
// FileProviderConfig.swift
// FileProviderExt
//
// Created by Claudio Cambra on 5/2/24.
//
import FileProvider
import Foundation
struct FileProviderConfig {
enum FileProviderConfigKey: String {
case fastEnumerationEnabled = "fastEnumerationEnabled"
}
let domainIdentifier: NSFileProviderDomainIdentifier
private var internalConfig: [String: Any] {
get {
let defaults = UserDefaults.standard
if let settings = defaults.dictionary(forKey: domainIdentifier.rawValue) {
return settings
}
let dictionary: [String: Any] = [:]
defaults.setValue(dictionary, forKey: domainIdentifier.rawValue)
return dictionary
}
set {
let defaults = UserDefaults.standard
defaults.setValue(newValue, forKey: domainIdentifier.rawValue)
}
}
}