The KeychainManager is a library that provides a convenient interface for securely managing email and password data in the keychain.


  • Save email and password securely in the keychain.
  • Update existing email and password stored in the keychain.
  • Delete email and password from the keychain.


Swift Package Manager

To use the KeychainManager library in your project, follow these steps:

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding KeyChainManager as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "", .upToNextMajor(from: "1.0.0"))


If you prefer not to use any of the aforementioned dependency managers, you can integrate KeyChainManager into your project manually.

  • Add the KeychainManager.swift file to your project.
  • Ensure that the Security.framework is linked with your project.


  • To get started with the KeychainManager, follow the example below:

import KeyChainManager
// Save email
let emailSaved = KeychainManager.shared.saveEmail(email: "[email protected]")
if emailSaved {
    print("Email saved successfully.")
} else {
    print("Failed to save email.")

// Save password
let passwordSaved = KeychainManager.shared.savePassword(password: "password123")
if passwordSaved {
    print("Password saved successfully.")
} else {
    print("Failed to save password.")

// Update email
let emailUpdated = KeychainManager.shared.updateEmail(newEmail: "[email protected]")
if emailUpdated {
    print("Email updated successfully.")
} else {
    print("Failed to update email.")

// Update password
let passwordUpdated = KeychainManager.shared.updatePassword(newPassword: "newpassword123")
if passwordUpdated {
    print("Password updated successfully.")
} else {
    print("Failed to update password.")

// Delete email
let emailDeleted = KeychainManager.shared.deleteEmail()
if emailDeleted {
    print("Email deleted successfully.")
} else {
    print("Failed to delete email.")

// Delete password
let passwordDeleted = KeychainManager.shared.deletePassword()
if passwordDeleted {
    print("Password deleted successfully.")
} else {
    print("Failed to delete password.")


Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.


The KeychainManager library is developed and maintained by Ghullam abbas.


For any inquiries, please contact [email protected].


View Github