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.
Keychain query creation - iOS Tutorial
From the course: Advanced iOS Development: Keychain Access
Keychain query creation
- [Instructor] So now let's start the process for storing our username and password in the keychain. So in our function storeLogin in the secure manager, we're going to create the dictionary that we use to write the data to the keychain. So the first thing I need to do is convert the password from a string to a data class. So I'm going to create a new line after line 11 and create that data. So I'll type let pwData equal password.data, and I'm going to use the UTF-8 encoding. Now, I'm going to force unwrap this, but you might want to use a guard instead. Now I'm going to create a dictionary. So on line 13, I'll type let query, and I'm going to declare that as a dictionary of key String and values Any, and then I'll type equal, and I'm going to open and close my square brackets. So the first thing we need to specify is the class. If we look back at the Apple documentation for the item class keys and values, we can see…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.