From the course: Advanced iOS Development: Keychain Access

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Handling search results

Handling search results - iOS Tutorial

From the course: Advanced iOS Development: Keychain Access

Start my 1-month free trial

Handling search results

- [Instructor] On line 19 I want to optionally bind that with the guard. So I'll say guard let theItem equal item as a dictionary of String:Any. And I'm going to use that optional as, so I'll add a question mark after it. Now that we know we have the item as a dictionary, I can continually optionally bind things with let pwData, and I can get this out of the item. So I'll have item open, square brackets, kSecValueData. The same key that we used when we created our query to store it. And I'll cast that as a string and make sure that we got that back as a data. And if we have that, we can decode that back to a string. So I'll say let password equal string and pass in the data. So I'm going to use the initializer that takes the data and pass in pwData and use the same encoding we used before, utf8. And then if we got the password I want to return it. But we can also get out the account since we are returning back all…

Contents