[quote='820277021, Great_Om, /thread/820277, /profile/Great_Om'] Since it was not possible using the UserDefaults class [/quote] What’s not possible? Reading a user default from a specific domain, like com.apple.Finder? You are correct that UserDefaults can’t do that, but running the defaults tool is not the best alternative. Rather, use CFPreferences. For example: import Foundation func main() { guard let obj = CFPreferencesCopyAppValue(ShowHardDrivesOnDesktop as NSString, com.apple.Finder as NSString), CFGetTypeID(obj) == CFBooleanGetTypeID(), let showHardDrivesOnDesktop = obj as? Bool else { fatalError() } print(showHardDrivesOnDesktop) } main() WARNING Unless otherwise documented, system preferences like this are an implementation detail. It might be OK to use them in a limited scope — like in a managed environment where you control all the copies of the code — but you should not rely on implementation details in a product that you deploy widely. The code above won’t work if your app is sandboxed. Then ag
Topic:
App & System Services
SubTopic:
General
Tags: