Swiftpack.co - GoodRequest/GoodPersistence as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by GoodRequest.
GoodRequest/GoodPersistence 2.2.0
💾 GoodPersistence is an iOS library that simplifies caching data in keychain and UserDefaults. Using a property wrapper, it reduces the complexity of implementing caching mechanisms, making it easier for developers to focus on app functionality. Compatible with latest Swift and supports all iOS devices. Easy to install with SPM.
⭐️ 33
🕓 1 week ago
iOS
.package(url: "https://github.com/GoodRequest/GoodPersistence.git", from: "2.2.0")

Logo

GoodPersistence

iOS Version Swift Version Supported devices Contains Test Dependency Manager

A property wrapper, designed to simplify the process of caching data into the keychain and UserDefaults storage. This wrapper makes it possible to quickly and easily implement caching mechanisms in the applications, without having to write extensive amounts of code. The property wrapper takes care of all the underlying complexity, allowing developers to focus on their application's functionality.

Documentation

You can check GoodPersistence package documentation here

Installation

Swift Package Manager

Create a Package.swift file and add the package dependency into the dependencies list. Or to integrate without package.swift add it through the Xcode add package interface.


import PackageDescription

let package = Package(
    name: "SampleProject",
    dependencies: [
        .Package(url: "https://github.com/GoodRequest/GoodPersistence" from: "addVersion")
    ]
)

Usage

Storing to the UserDeaults

@UserDefaultValue(String(describing: AppState.self), defaultValue: .initial)
var appState: AppState

Storing to the KeyChain

@KeychainValue("accessToken", defaultValue: "", accessibility: .afterFirstUnlockThisDeviceOnly)
var accessToken: String

Using Publishers

lazy var appStatePublisher = _appState.publisher
    .dropFirst()
    .removeDuplicates()
    .eraseToAnyPublisher()

License

GoodPersistence is released under the MIT license. See LICENSE for details.

GitHub

link
Stars: 33
Last commit: 1 week ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Logger/Monitor support
1 week ago

What's Changed

New Contributors

Full Changelog: https://github.com/GoodRequest/GoodPersistence/compare/2.1.0...2.2.0

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