https://github.com/goodrequest/doccautomatization_ios
https://github.com/goodrequest/doccautomatization_ios
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/goodrequest/doccautomatization_ios
- Owner: GoodRequest
- License: mit
- Created: 2024-09-10T13:12:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-26T11:14:26.000Z (over 1 year ago)
- Last Synced: 2025-06-09T01:02:23.556Z (10 months ago)
- Language: Swift
- Size: 55.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README

# GoodPersistence
[]()
[](https://docs.swift.org/swift-book/)
[]()
[]()
[](#swiftpackagemanager)
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](https://goodrequest.github.io/GoodPersistence/documentation/goodpersistence/)
## 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.
[//]: # (Don't forget to add the version once available)
```swift
import PackageDescription
let package = Package(
name: "SampleProject",
dependencies: [
.Package(url: "https://github.com/GoodRequest/GoodPersistence" from: "addVersion")
]
)
```
## Usage
Storing to the UserDefaults
```swift
@UserDefaultValue(String(describing: AppState.self), defaultValue: .initial)
var appState: AppState
```
Storing to the KeyChain
```swift
@KeychainValue("accessToken", defaultValue: "", accessibility: .afterFirstUnlockThisDeviceOnly)
var accessToken: String
```
Using Publishers
```swift
lazy var appStatePublisher = _appState.publisher
.dropFirst()
.removeDuplicates()
.eraseToAnyPublisher()
```
## License
GoodPersistence is released under the MIT license. See [LICENSE](LICENSE.md) for details.