iossettings.bundletoggleswitch

How can I change default value of toggle Switch from Settings.bundle


i want to change default value programmatically of toggle switch from settings bundle. If someone can help me please with that. enter image description here


Solution

  • Use register(defaults:) to set default values for your UserDefaults values, like so:

    UserDefaults.standard.register(defaults: [
       "toggleSwitchKey": true
    ])