{"id":20918220,"url":"https://github.com/almazrafi/keyvaluecontainer","last_synced_at":"2025-05-13T12:31:12.964Z","repository":{"id":41783232,"uuid":"229465689","full_name":"almazrafi/KeyValueContainer","owner":"almazrafi","description":"Type-safe containers for key-value storage","archived":false,"fork":false,"pushed_at":"2023-03-17T06:03:56.000Z","size":76,"stargazers_count":10,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T12:02:07.856Z","etag":null,"topics":["carthage","cocoapods","ios","keychain","macos","spm","swift","tvos","userdefaults","watchos","xcode"],"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/almazrafi.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}},"created_at":"2019-12-21T18:12:46.000Z","updated_at":"2023-12-27T17:44:38.000Z","dependencies_parsed_at":"2023-02-16T13:30:46.743Z","dependency_job_id":null,"html_url":"https://github.com/almazrafi/KeyValueContainer","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almazrafi%2FKeyValueContainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almazrafi%2FKeyValueContainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almazrafi%2FKeyValueContainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almazrafi%2FKeyValueContainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/almazrafi","download_url":"https://codeload.github.com/almazrafi/KeyValueContainer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253942243,"owners_count":21988016,"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":["carthage","cocoapods","ios","keychain","macos","spm","swift","tvos","userdefaults","watchos","xcode"],"created_at":"2024-11-18T16:38:12.459Z","updated_at":"2025-05-13T12:31:12.696Z","avatar_url":"https://github.com/almazrafi.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KeyValueContainer\n[![Build Status](https://github.com/almazrafi/KeyValueContainer/workflows/CI/badge.svg?branch=main)](https://github.com/almazrafi/KeyValueContainer/actions)\n[![Codecov](https://codecov.io/gh/almazrafi/KeyValueContainer/branch/master/graph/badge.svg)](https://codecov.io/gh/almazrafi/KeyValueContainer)\n[![Cocoapods](https://img.shields.io/cocoapods/v/KeyValueContainer)](http://cocoapods.org/pods/KeyValueContainer)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-Compatible-brightgreen)](https://github.com/Carthage/Carthage)\n[![SPM compatible](https://img.shields.io/badge/SPM-Compatible-brightgreen)](https://swift.org/package-manager/)\n[![Platforms](https://img.shields.io/cocoapods/p/KeyValueContainer)](https://developer.apple.com/discover/)\n[![Xcode](https://img.shields.io/badge/Xcode-13-blue)](https://developer.apple.com/xcode)\n[![Swift](https://img.shields.io/badge/Swift-5.5-orange)](https://swift.org)\n[![License](https://img.shields.io/github/license/almazrafi/KeyValueContainer)](https://opensource.org/licenses/MIT)\n\n## Requirements\n- iOS 12.0+ / macOS 10.14+ / watchOS 5.0+ / tvOS 12.0+\n- Xcode 13.0+\n- Swift 5.5+\n\n## Usage\n#### Declare a container:\n``` swift\nextension PersistentStorage {\n    var foobar: KeyValueContainer\u003cInt\u003e {\n        makeContainer()\n    }\n}\n```\n\nThis will create a container with the same key as property name: \"foobar\"\n\n#### Reading a value from the storage:\n``` swift\nlet foobar = PersistentStorage.default.foobar.value\n```\n\nSame as using UserDefaults:\n``` swift\nlet foobar = UserDefaults.standard.integer(forKey: \"foobar\")\n```\n\n#### Writing a value to the storage:\n``` swift\nPersistentStorage.default.foobar.value = 123\n```\n\nSame as using UserDefaults:\n``` swift\nUserDefaults.standard.set(123, forKey: \"foobar\")\n```\n\n## Installation\n### CocoaPods\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n```bash\n$ gem install cocoapods\n```\n\nTo integrate KeyValueContainer into your Xcode project using [CocoaPods](http://cocoapods.org), specify it in your `Podfile`:\n```ruby\nplatform :ios, '12.0'\nuse_frameworks!\n\ntarget '\u003cYour Target Name\u003e' do\n    pod 'KeyValueContainer'\nend\n```\n\nFinally run the following command:\n```bash\n$ pod install\n```\n\n### Carthage\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. You can install Carthage with Homebrew using the following command:\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate KeyValueContainer into your Xcode project using Carthage, specify it in your `Cartfile`:\n```ogdl\ngithub \"almazrafi/KeyValueContainer\" ~\u003e 1.2.0\n```\n\nFinally run `carthage update` to build the framework and drag the built `KeyValueContainer.framework` into your Xcode project.\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.\n\nTo integrate KeyValueContainer into your Xcode project using Swift Package Manager,\nadd the following as a dependency to your `Package.swift`:\n```swift\n.package(url: \"https://github.com/almazrafi/KeyValueContainer.git\", from: \"1.2.0\")\n```\nand then specify `\"KeyValueContainer\"` as a dependency of the Target in which you wish to use KeyValueContainer.\n\nHere's an example `Package.swift`:\n```swift\n// swift-tools-version:5.5\nimport PackageDescription\n\nlet package = Package(\n    name: \"MyPackage\",\n    products: [\n        .library(name: \"MyPackage\", targets: [\"MyPackage\"])\n    ],\n    dependencies: [\n        .package(url: \"https://github.com/almazrafi/KeyValueContainer.git\", from: \"1.2.0\")\n    ],\n    targets: [\n        .target(name: \"MyPackage\", dependencies: [\"KeyValueContainer\"])\n    ]\n)\n```\n\n## Communication\n- If you need help, open an issue.\n- If you found a bug, open an issue.\n- If you have a feature request, open an issue.\n- If you want to contribute, submit a pull request.\n\n## License\nKeyValueContainer is available under the MIT license. See the [LICENSE](LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falmazrafi%2Fkeyvaluecontainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falmazrafi%2Fkeyvaluecontainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falmazrafi%2Fkeyvaluecontainer/lists"}