From the course: Advanced iOS Development: Keychain Access

Unlock the full course today

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

Searching in keychain

Searching in keychain - iOS Tutorial

From the course: Advanced iOS Development: Keychain Access

Start my 1-month free trial

Searching in keychain

- [Instructor] So now that we have the query, we need to write a function to send that query in and fetch the data from the keychain. So above that I'll create another couple blank lines. And on line 11 I'm going to create a new function that actually interacts with the keychain. So I'll start by typing static func find in keychain. And this is going to take a query just like we did before. And specify the type as a dictionary with a key value string and the value type of any. And it's also going to return a string optional. So now we can call this from our retrieve password and return the results. So when we call this sec item copy matching, we need to pass in that second parameter as a reference. So let's create that now. So on line 12, I'll type var item and specify the type as CF type ref optional. And then we want to call the actual function and pass in our query and this reference. We also want to store the result so…

Contents