Contents

Settings

Configure your app using data you store persistently on the local disk or in iCloud.

Overview

Settings are small pieces of data that you use to configure your app’s interface and behavior. Instead of recompiling your code every time you want to make a change, your code uses settings to alter your app’s configuration dynamically. Typically, you use this kind of data to reflect the personal preferences of the person using your app. For example, a drawing app might store whether someone prefers inches or centimeters for distance measurements. However, you can also use settings to manage internal behaviors, such as the amount of data your app logs during testing.

The system stores each app’s settings persistently to disk, so that they are available between launches. You typically store strings, numbers, and other simple data types to disk, but you can store more complex types as needed. The UserDefaults type manages settings for your app on the current device, and doesn’t share those settings with the person’s other devices. To share settings with instances of your app running on all of the person’s devices, place them in iCloud using the NSUbiquitousKeyValueStore type.

Topics

App-specific settings

Settings interfaces

iCloud key and value storage

See Also

Files and Data Persistence