Keychain.swift

Lukas Lipka
1 min readAug 24, 2018

When working on the new version of Tink we were very deliberate when bringing in third party dependencies and frameworks — primarily for security, but also due to the incurred startup time cost when including too many frameworks in your app bundle. It’s easy to fall into the trap of pulling in a new CocoaPod or Carthage dependency each time you need to solve a problem.

Specifically I’ve seen many projects include a third party dependency for Keychain access. This is slightly unnecessary, since it’s something you can do yourself in under 50 lines of code. Granted, the Security framework APIs are not the most pleasant to work with, but wrapping them up in a API with minimal surface provides a simple way to access them.

Today we are open sourcing our Keychain implementation as a micro framework (a single file) that you can include in your own project. Check it out on GitHub. If writing succinct Swift code is your thing — join us.

--

--