Working with the Keychain

Episode #428 | 25 minutes | published on February 20, 2020 | Uses Xcode-11.3.1, Swift-5.1
Subscribers Only
The Keychain is the best place to store sensitive data such as API keys, auth tokens, and login credentials. On device the data is stored encrypted. Once unlocked, you can retrieve the values you saved, keeping the sensitive data secured by the user's passcode, Face ID, or Touch ID. Using the keychain is not very straightforward, however. It has a low-level C-adapted API and is a little cumbersome to work with. In this episode we will look at how to add, query, and remove items from the keychain, then look at a popular open-source library for making storing values in the keychain much easier to implement.



  • Keychain Access - a close API wrapper around Keychain, making its use more Swifty. If you're looking to use Keychain but don't want to abstract any of its functionality, take a look at this.
  • Square Valet - a useful library for making keychain access incredibly easy.
blog comments powered by Disqus