3

I saved my account through Locksmith Keychain, everything works fine, right now i need to parse the data stored to a textField, how can i do it please? Here is the code that i use to save my account:

let accountsave = Locksmith.saveData(["account": self.txtAccount.text], forUserAccount: "myUserAccount", inService: "myAccount").

Right now i need to parse the data store to a textfield in swift. Please help

aff
  • 162
  • 2
  • 6
  • 17

1 Answers1

0

From what I understand of your question you're asking for something similar to this:

let (dictionary, error) = Locksmith.loadDataForUserAccount("myUserAccount", inService: "myAccount")
if let userData = dictionary as? [String:String] {
    if let account = userData["account"] {
        self.txtAccount.text = account
    }
}
Chackle
  • 2,249
  • 18
  • 34
  • i have this error in the second line : 'NSDictionary? does not have a ember named 'subcript' – Joel Felix ST JOY May 01 '15 at 14:26
  • Check my answer again, I forgot to unwrap the optional value. – Chackle May 01 '15 at 14:28
  • I have another problem, try to see if you can help me to resolve it. Here is the link: http://stackoverflow.com/questions/29972336/fatal-error-array-index-out-of-range-in-uitableview-on-back-to-previous-control?noredirect=1#comment48064812_29972336 – Joel Felix ST JOY May 01 '15 at 15:08