Swiftpack.co -  GroupeMINASTE/Keychain.swift as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
GroupeMINASTE/Keychain.swift
The easiest way to securely store data in the keychain. It's implementation is really close to the UserDefaults.
.package(url: "https://github.com/GroupeMINASTE/Keychain.swift.git", from: "1.0.5")

Keychain

A swift package to easily implement Keychain on your iOS apps, with a UserDefaults-like implementation.

Installation

Add https://github.com/GroupeMINASTE/Keychain.swift.git to your Swift Package configuration (or using the Xcode menu: File > Swift Packages > Add Package Dependency)

Usage

// Import the package
import Keychain

// When your need to access the Keychain, initialize it like this:
let keychain = Keychain()

// If you want to use an access group for your Keychain, pass it as a String argument
// let keychain = Keychain(accessGroup: "TEAMID.your.app.identifier")

// To save a value for a key named "yourKey", simply use:
let saved:Bool = keychain.save(5, forKey: "yourKey")
// The returned boolean indicates if the operation was successful

// To read a value for this key
let value = keychain.value(forKey: "yourKey") as? Int ?? 0

// And finally to delete your key and it's value, use:
let deleted:Bool = keychain.remove(forKey: "yourKey")
// The returned boolean indicates if the operation was successful

GitHub

link
Stars: 4
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Keychain.swift v1.0.5
1 week ago

Adding support for macOS

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API