Keychain Services API Tutorial for Passwords in Swift |

In this Keychain tutorial for Swift on iOS, you’ll learn how to interact with the C language API to securely store passwords in the iOS Keychain.

This is a companion discussion topic for the original entry at

It is a good tutorial, however I thing is missing and example of use applied to a real app would be great. Only to clarify all the concepts, for example parameters an other basic questions that can emerge.

@human4 Thanks for your feedback. If you have any additional question please let me know. Lorenzo

Thanks for the tutorial. I found the implementation simple and useful, however I needed it on macOS. Based on the source licensing, I went ahead and created a project for it, fixed a thing or two and it can now be pulled via Carthage from GitHub:

SecureStore on GitHub

Credit was given where credit is due, thanks @lorenzoboaro !

I used the wrapper in this tutorial to store some passwords used for encryption. I was hoping they would automatically be included any iCloud or iTunes backup/restore. I think they are if the same device is used for backup/restore but it appears that is not the case for a new device.

Is it possible to set this wrapper up to allow restore to a new device and keep the passwords?

@lorenzoboaro Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi @swhitt, sorry for the delay. I’m not sure if kSecAttrSynchronizable could be the solution to your problems.

(see Apple Developer Documentation)

To say the truth I’ve never had the chance to play with it.

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!