Contents

addSuite(named:)

Inserts settings for the specified domain into the search list of the current object.

Declaration

func addSuite(named suiteName: String)

Parameters

  • suiteName:

    The bundle identifier for the domain you want to add. You don’t need to specify a bundle identifier for another app. Instead, you might specify the app group identifier you use to share data between multiple apps or between your app and an app extension. Don’t specify your app’s bundle identifier or the Globaldomain identifier in this parameter.

Discussion

This method inserts the domain for your custom suite of settings after the app domain and before the global domain. This arrangement causes the UserDefaults object to return your app-specific settings first, followed by settings from the specified suite. If you call this method multiple times, the UserDefaults object searches your suites in the order you added them.

This method doesn’t affect the destination for write operations. If you want to write settings to a custom suite, use the init(suiteName:) initializer to construct a UserDefaults object specifically for that suite.

See Also

Adding and removing search domains