{"id":26078308,"url":"https://github.com/danielepantaleone/persistedproperty","last_synced_at":"2025-08-22T22:15:18.533Z","repository":{"id":176979271,"uuid":"654504893","full_name":"danielepantaleone/PersistedProperty","owner":"danielepantaleone","description":"A lightweight framework to persist iOS properties written in Swift","archived":false,"fork":false,"pushed_at":"2024-02-07T13:01:36.000Z","size":107,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-21T15:02:51.969Z","etag":null,"topics":["keychain","persistable","persistence","properties","property-wrapper","storage","user-defaults"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielepantaleone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-06-16T09:18:13.000Z","updated_at":"2023-06-20T06:28:32.000Z","dependencies_parsed_at":"2023-06-28T20:01:03.845Z","dependency_job_id":"bedccb6f-5b6b-431d-bc9e-94a64f82e639","html_url":"https://github.com/danielepantaleone/PersistedProperty","commit_stats":{"total_commits":37,"total_committers":2,"mean_commits":18.5,"dds":0.05405405405405406,"last_synced_commit":"94ba01eb7cd9e20fe612a4cd84e26ee23576f8fe"},"previous_names":["danielepantaleone/persistedproperty"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielepantaleone%2FPersistedProperty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielepantaleone%2FPersistedProperty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielepantaleone%2FPersistedProperty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielepantaleone%2FPersistedProperty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielepantaleone","download_url":"https://codeload.github.com/danielepantaleone/PersistedProperty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242640907,"owners_count":20162054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["keychain","persistable","persistence","properties","property-wrapper","storage","user-defaults"],"created_at":"2025-03-09T03:57:44.906Z","updated_at":"2025-03-09T03:57:45.444Z","avatar_url":"https://github.com/danielepantaleone.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"left\"\u003e\n\u003cimg alt=\"logo\" src=\"./Assets/Logo.png\" width=\"400\"\u003e\n\u003c/p\u003e\n\n[![Swift](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdanielepantaleone%2FPersistedProperty%2Fbadge%3Ftype%3Dswift-versions\u0026style=flat-square)](https://swiftpackageindex.com/danielepantaleone/PersistedProperty)\n[![Platform](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdanielepantaleone%2FPersistedProperty%2Fbadge%3Ftype%3Dplatforms\u0026style=flat-square)](https://swiftpackageindex.com/danielepantaleone/PersistedProperty)\n![Cocoapods](https://img.shields.io/cocoapods/v/PersistedProperty?style=flat-square)\n![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/danielepantaleone/PersistedProperty?style=flat-square)\n![GitHub](https://img.shields.io/github/license/danielepantaleone/PersistedProperty?style=flat-square)\n[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/danielepantaleone/PersistedProperty/swift-tests.yml?style=flat-square\u0026logo=github)](https://github.com/danielepantaleone/PersistedProperty/actions/workflows/swift-tests.yml)\n\nA Swift-based lightweight framework that enable the persistence of Swift properties on a pre-configured storage.\n\n## Table of contents\n\n* [Feature Highlights](#feature-highlights)\n* [Basic usage](#basic-usage)\n* [Advanced usage](#advanced-usage)\n* [Installation](#installation)\n    * [Cocoapods](#cocoapods)\n    * [Swift Package Manager](#swift-package-manager)\n* [Contributing](#contributing)\n* [License](#license)\n\n## Feature Highlights\n\n- Compatible with iOS and macOS\n- Native support for `UserDefaults` based storage\n- Native support for iOS `KeyChain` based storage\n- Property persistence achieved through the `@Persisted` property wrapper\n- Properties wrapped with `@Persisted` must conform to the `Codable` protocol\n- Possibility to specify your custom storage facility\n\n## Basic usage\n\nCreating a persisted property it's just a matter of adding the `@Persisted` property wrapper on top of your variable, specifying the  key used to reflect the property value on the storage and assigning a default value to the property itself. If the property is `Optional` and no default value is provided, `nil` must be specified:\n\n```swift\n@Persisted(key: \"myProperty\")\nvar myProperty: Double = 10.0\n@Persisted(key: \"myOptionalProperty\")\nvar myOptionalProperty: String? = nil // default value cannot be omitted\n```\n\n## Advanced usage\n\nIt's possible to customize on which storage service properties are going to be persisted. `PersistedProperty` provide native support for `UserDefaults` backed storage and `KeyChain` based storage. You can configure which storage to use when adding the `@Persisted` property wrapper on top of your property:\n\n```swift\n// This will be persisted in the standard UserDefaults (same as omitting the storage parameter).\n@Persisted(key: \"myProperty\", storage: .standard)\nvar myProperty: Double = 10.0\n// This will be persisted in the iOS KeyChain.\n@Persisted(key: \"myPassword\", storage: .keychain)\nvar myPassword: String? = nil\n```\n\nAdditionally, you can specify your custom storage service by creating your storage provider that conforms to the `StorageService` protocol:\n\n```swift\n/// A custom storage provider conforming to the StorageService protocol\nclass MyCustomStorageService: StorageService {\n    \n    func load\u003cValueType\u003e(key: String) -\u003e ValueType? where ValueType: Codable ...\n    \n    func save\u003cValueType\u003e(_ value: ValueType, key: String) where ValueType: Codable ...\n    \n    func remove(key: String) ...\n    \n}\n\nlet myService: StorageService = MyCustomStorageService()\n\n// This will be persisted in the custom storage service.\n@Persisted(key: \"myProperty\", storage: .custom(service: myService))\nvar myProperty: Double = 10.0\n```\n\n## Installation\n\n### Cocoapods\n\nAdd the dependency to the `PersistedProperty` framework in your `Podfile`:\n\n```ruby\npod 'PersistedProperty', '~\u003e 1.1.0'\n```\n\n### Swift Package Manager\n\nAdd it as a dependency in a Swift Package:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/danielepantaleone/PersistedProperty.git\", .upToNextMajor(from: \"1.1.0\"))\n]\n```\n\n## Contributing\n\nIf you like this project you can contribute it by:\n\n- Submit a bug report by opening an [issue](https://github.com/danielepantaleone/PersistedProperty/issues)\n- Submit code by opening a [pull request](https://github.com/danielepantaleone/PersistedProperty/pulls)\n\n## License\n\n```\nMIT License\n\nCopyright (c) 2023 Daniele Pantaleone\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielepantaleone%2Fpersistedproperty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielepantaleone%2Fpersistedproperty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielepantaleone%2Fpersistedproperty/lists"}