Link to home
Start Free TrialLog in
Avatar of kblau
kblau

asked on

swift library profile userDefaults

If I use swift playground:
//: Playground - noun: a place where people can play

import UIKit

let userDefaults: NSUserDefaults = NSUserDefaults.standardUserDefaults()
userDefaults.setInteger(10, forKey: "age")
userDefaults.setInteger(10, forKey: "age1")
userDefaults.setObject("John", forKey: "name")
userDefaults.setObject("John2", forKey: "name2")
userDefaults.setObject("John3", forKey: "name3")
userDefaults.synchronize()

let Library:String =
    NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.LibraryDirectory, NSSearchPathDomainMask.UserDomainMask, true) [0] as String + "/Preferences"

if I look at the string for the last statement, it's value is:
"/var/folders/hr/6ybn_7091jl7z5_l7f8ym8f00000gn/T/com.apple.dt.Xcode.pg/containers/com.apple.dt.playground.stub.iOS_Simulator.MyPlayground2-B5D7F19D-EACB-4290-BC18-75DF85E15995/Library/Preferences

It was my understanding that i could do in the terminal open + theAboveString.  This does not work, but I can do a Finder->Go to folder -> ~/Library/Preferences

Then I was suppose to see plist files with keys "age,name, etc" (see above in seeing userDefaults.setxxx).  I can not see the contents of any plist files with this information.  Has this changed with new releases of Xcode?
Avatar of kblau
kblau

ASKER

forgot to mention that I execute the playground..
Avatar of kblau

ASKER

In the swift playground, where is the plist file?
ASKER CERTIFIED SOLUTION
Avatar of kblau
kblau

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial