Latest 4.0.0
License MIT
Platforms ios 8.0, requires ARC

Magical User settings class for iOS


To start using WRUserSettings just subclass WRUserSettings class and you are ready to go!!!

So every property you add to your subclass will be stored in NSUserDefaults. Default property is nil or filled by default system value for primitive types like NSInteger, BOOL, CGRect etc.

Basic usage

To simple usage you only need add properties to header file of subclass:

class MyUserSettings: WRUserSettings {
    dynamic var shouldShowTutorial: Bool = true
    dynamic var temperatureUnit: String = "C"
    dynamic var notyficationOn: Bool = false

From now every time you set property is automatically save it in NSUserDefaults for you.

Setting value

Your class is singleton so you should use +shared method to get instance of it:

MyUserSettings.shared.shouldShowTutorial = false

Class will automatically save value false to NSUserDefaults

Getting value

To get value just get instance of class and property:

let shouldItReallyShowTutorial = MyUserSettings.shared.shouldShowTutorial

Default values

To set default values just use default assigment as above. We are storing defaults in instance.

Reset settings

If you want reset settings call anywhere method reset() on your singleton. This method iterate through all saved settings and delete it from NSUserDefaults and assign to properties default values.

Printing description

To print description of stored values simply print your singleton. It prints only stored values so it don’t show default values that you set.

Using suiteName

To use suiteName all you need to do is override method func suiteName() -> String? in your subclass:

class MyUserSettings: WRUserSettings {
    dynamic var shouldShowTutorial: Bool = true

    override func suiteName() -> String? {
        return "com.chillicoder.my_app_group"



CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build WRUserSettings 3.0.0+.

To integrate WRUserSettings into your Xcode project using CocoaPods, specify it in your Podfile:

source ''
platform :ios, '8.0'

target '<Your Target Name>' do
    pod 'WRUserSettings', '~> 3.0.0'

Then, run the following command:

$ pod install

Change log


– Refactored Swift 4.0 version
– Added support for suiteName
– Auto migration when you start using suiteName
– BUG: fix problem with not unregistred notifications after deinit


– Refactored Swift 3.0 version


– Swift version


– Add -resetSettings method

– Add simple tests

– Example now use pod instead of imported WRUserSettings files.


– Added support for structures like: CGPoint, CGRect, CGSize etc.

– Modify example to show CGPoint usage.


– Basic stuff working


  • [] Make example
  • [] Tests


WRUserSettings requires either iOS 8.0 and above.


WRUserSettings is available under the MIT license. See the LICENSE file for more info.


WRUserSettings uses ARC.


Rafał Wójcik

Latest podspec

    "name": "WRUserSettings",
    "version": "4.0.0",
    "license": "MIT",
    "summary": "Magical User settings class for iOS written in Swift",
    "homepage": "",
    "authors": "Rafau0142 Wu00f3jcik",
    "source": {
        "git": "",
        "tag": "4.0.0"
    "module_name": "WRUserSettings",
    "platforms": {
        "ios": "8.0"
    "requires_arc": true,
    "source_files": "WRUserSettings/**/*.swift",
    "swift_version": "4.0.3"

Pin It on Pinterest

Share This