<commit_before># GVUserDefaults - NSUserDefaults access via properties

Tired of writing all that code to get and set defaults in NSUserDefaults? Want to have code completion and compiler checks by using properties instead?

## Usage
Create a category on `GVUserDefaults`, add some properties in the .h file and make them `@dynamic` in the .m file.

    // .h
    @interface GVUserDefaults (Properties)
    @property NSString *userName;
    @property NSNumber *userId;
    @end

    // .m
    @implementation GVUserDefaults (Properties)
    @dynamic userName;
    @dynamic userId;
    @end

Now, instead of using `[[NSUserDefaults standardUserDefaults] objectForKey:@"userName"]`, you can simply use `[GVUserDefaults standardUserDefaults].userName`.

You can even save defaults by setting the property:

    [GVUserDefaults standardUserDefaults].userName = @"myusername";

### Key prefix
The keys in NSUserDefaults are the same name as your properties. If you'd like to prefix them, add a `prefix` method to your category:

    - (NSString *)prefix {
        return @"NSUSerDefault:";
    }

### Registering defaults
Registering defaults is done as usual, on NSUserDefaults directly (use the same prefix, if any!).

    NSDictionary *defaults = @{
        @"NSUSerDefault:userName": @"default",
        @"NSUSerDefault:userId": @1
    };

    [[NSUserDefaults standardUserDefaults] registerDefaults:defaults];


## Install
Install via [CocoaPods](http://cocoapods.org) (`pod 'GVUserDefaults'`) or drag the code in GVUserDefaults to your project.


## Issues and questions
Have a bug? Please [create an issue on GitHub](https://github.com/gangverk/GVUserDefaults/issues)!

<commit_msg>Make it clear which folder to use<commit_after># GVUserDefaults - NSUserDefaults access via properties

Tired of writing all that code to get and set defaults in NSUserDefaults? Want to have code completion and compiler checks by using properties instead?

## Usage
Create a category on `GVUserDefaults`, add some properties in the .h file and make them `@dynamic` in the .m file.

    // .h
    @interface GVUserDefaults (Properties)
    @property NSString *userName;
    @property NSNumber *userId;
    @end

    // .m
    @implementation GVUserDefaults (Properties)
    @dynamic userName;
    @dynamic userId;
    @end

Now, instead of using `[[NSUserDefaults standardUserDefaults] objectForKey:@"userName"]`, you can simply use `[GVUserDefaults standardUserDefaults].userName`.

You can even save defaults by setting the property:

    [GVUserDefaults standardUserDefaults].userName = @"myusername";

### Key prefix
The keys in NSUserDefaults are the same name as your properties. If you'd like to prefix them, add a `prefix` method to your category:

    - (NSString *)prefix {
        return @"NSUSerDefault:";
    }

### Registering defaults
Registering defaults is done as usual, on NSUserDefaults directly (use the same prefix, if any!).

    NSDictionary *defaults = @{
        @"NSUSerDefault:userName": @"default",
        @"NSUSerDefault:userId": @1
    };

    [[NSUserDefaults standardUserDefaults] registerDefaults:defaults];


## Install
Install via [CocoaPods](http://cocoapods.org) (`pod 'GVUserDefaults'`) or drag the code in the GVUserDefaults subfolder to your project.


## Issues and questions
Have a bug? Please [create an issue on GitHub](https://github.com/gangverk/GVUserDefaults/issues)!


{'fraction_non_alphanumeric': 0.09229864785420341, 'fraction_numerical': 0.0005878894767783657, 'mean_word_length': 4.148260211800302, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6826234', 'n_tokens_mistral': 1012, 'n_tokens_neox': 906, 'n_words': 368}