Library Allowing Access Of NSUserDefault Variables As Properties

I’ve mentioned some great libraries for working with NSUserDefaults such as MKiCloudSync that allows you to automatically save NSUserDefaults to iCloud.

Here’s a library from Gangverk called GVUserDefaults that makes working with NSUserDefaults easier by allowing you to access NSUSerDefaults using properties giving you code completion and type checking.

The Readme shows a few great examples showing how much easier this makes things:

To access an NSUserDefault variable instead of –

[[NSUserDefaults standardUserDefaults] objectForKey:@"userName"]

You simply use –

[GVUserDefaults standardUserDefaults].userName

You can also work set NSUserDefault variables  as you would other properties –

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

You can find GVUserDefaults on Github here.

A simple idea that should save you some time when working with NSUSerDefaults.

DeliciousTwitterFacebookRedditLinkedInEmail

Original article: Library Allowing Access Of NSUserDefault Variables As Properties

©2012 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *