I\'m using a tuple to store something like this.
var accessLavels: (hasInventoryAccess: Bool, hasPayrolAccess: Bool)
accessLavels = (hasInventoryAccess: true
I had a tuple with 3 values.
The following code was used for saving the tuple. Basically, I created a string from tuple (with components separated by a comma).
let defaultsLoad = NSUserDefaults.standardUserDefaults()
if appSingleton.runwayDestShared != nil
{
// Creating a String from the tuple
let runwayDestString = appSingleton.runwayDestShared!.0 + "," + appSingleton.runwayDestShared!.1 + "," + appSingleton.runwayDestShared!.2
defaultsLoad.setObject(runwayDestString, forKey: "RunwayDest")
}
To retrieve the tuple, I retrieved the string, broke it into array and used the array to re-create a tuple.
let runwayDestString = defaultsLoad.stringForKey("RunwayDest")
if let runwayDestString = runwayDestString
{
let runwayDestArray = runwayDestString.componentsSeparatedByString(",")
appSingleton.runwayDestShared = (runwayDestArray[0],runwayDestArray[1],runwayDestArray[2])
}