Created
February 27, 2015 20:48
-
-
Save justingreerbbi/0c3b66fbab7d34a9845f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Simple NSDefaults Wrapper | |
// | |
// Created by Justin Greer on 2/27/15. | |
// Copyright (c) 2015 Justin Greer Interactive, LLC. All rights reserved. | |
// | |
import Foundation | |
class FCStorage { | |
let prefs: NSUserDefaults = NSUserDefaults.standardUserDefaults() | |
//////////////////////////////// | |
// SET/GET STRING | |
//////////////////////////////// | |
func setString ( key: String, value: String) | |
{ | |
self.prefs.setObject(value, forKey: key) | |
} | |
func getString ( key: String ) -> String | |
{ | |
return self.prefs.stringForKey( key )! | |
} | |
//////////////////////////////// | |
// SET/GET BOOL | |
//////////////////////////////// | |
func setBool ( key: String, value: Bool) | |
{ | |
self.prefs.setObject(value, forKey: key) | |
} | |
func getBool ( key: String ) -> Bool | |
{ | |
return self.prefs.boolForKey( key ) | |
} | |
//////////////////////////////// | |
// SET/GET INTEGER | |
//////////////////////////////// | |
func setIntl ( key: String, value: Int) | |
{ | |
self.prefs.setObject(value, forKey: key) | |
} | |
func getInt ( key: String ) -> Int | |
{ | |
return self.prefs.integerForKey( key ) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment