Get Updates By E-mail 

Article Written By:
Johann Dowa

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.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments