{"id":21174791,"url":"https://github.com/mindinventory/genericlocalpersistence","last_synced_at":"2025-07-09T21:31:07.002Z","repository":{"id":56912678,"uuid":"370650849","full_name":"Mindinventory/GenericLocalPersistence","owner":"Mindinventory","description":"GenericLocalPersistence is a clean and easy-to-use code that is useful for integrating local storage like UserDefaults, PList, Keychain.","archived":false,"fork":false,"pushed_at":"2021-06-02T09:41:36.000Z","size":29,"stargazers_count":17,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-08T18:17:55.985Z","etag":null,"topics":["ios","keychain","localstorage","plist","plist-files","savedata","storage","swift","userdefaults"],"latest_commit_sha":null,"homepage":"https://www.mindinventory.com/iphone-application-development.php","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/Mindinventory.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":"2021-05-25T10:18:34.000Z","updated_at":"2022-09-20T13:40:34.000Z","dependencies_parsed_at":"2022-08-21T03:20:28.573Z","dependency_job_id":null,"html_url":"https://github.com/Mindinventory/GenericLocalPersistence","commit_stats":null,"previous_names":["riddhi-mi/genericlocalpersistence"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Mindinventory/GenericLocalPersistence","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mindinventory%2FGenericLocalPersistence","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mindinventory%2FGenericLocalPersistence/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mindinventory%2FGenericLocalPersistence/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mindinventory%2FGenericLocalPersistence/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mindinventory","download_url":"https://codeload.github.com/Mindinventory/GenericLocalPersistence/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mindinventory%2FGenericLocalPersistence/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264503949,"owners_count":23618762,"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":["ios","keychain","localstorage","plist","plist-files","savedata","storage","swift","userdefaults"],"created_at":"2024-11-20T16:56:14.236Z","updated_at":"2025-07-09T21:31:06.767Z","avatar_url":"https://github.com/Mindinventory.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GenericLocalPersistence\n\nGenericLocalPersistence is a clean and easy-to-use code that is useful for integrating local storage like, \n\n* **UserDefaults**\n* **PList**\n* **Keychain**\n\nRead more from [MEDIUM](https://medium.com/mindful-engineering/generic-local-persistence-8b4cfa5dbf7d)\n\n## Installation\n\nFrom CocoaPods\nFirst, add the following line to your Podfile \n\n```bash\npod install 'GenericLocalPersistence', '~\u003e 0.0.1’\n\npod 'GenericLocalPersistence', :git =\u003e 'https://github.com/Riddhi-mi/GenericLocalPersistence.git'\n```\n\n\n# Usage of UserDefault\n\nimport GenericLocalPersistence\n\n### Set \u0026 Get value from User Default\n\n```python\nDefaultManager().saveValueInDefault(value: \"TestValue\", using: \"TestKey\")\nlet valueFetch:String = DefaultManager().getValue(\"TestKey\") ?? \"\"\n```\n\n# Usage of Plist\n\nimport GenericLocalPersistence\n\n### Set \u0026 Get value from plist file\nReplace \"userDetails\" with custom name for creating plist file to store data \n\n```python\nprivate let managerPlist = plistManager(named: \"userDetails\")\n```\n\n```python\nmanagerPlist?.saveDatatoPlist(value: \"TestString Value\", using: \"TestKey\")\nlet stringValue :String = managerPlist?.getDictionary(key: \"TestKey\") ?? \"\"\n```\n\n## Usage of KeyChain\nimport GenericLocalPersistence\n\n### Set \u0026 Get value from KeyChain file\n\n\n#### Store password value\n\n```python\nlet passWordString = textPassword?.text?.data(using: .utf8, allowLossyConversion: false) ?? Data()\nlet passwordStatus = KeyChainManager()?.save(key: \"com.appBundleID.password\", data: passWordString)\n\n//Retrive data\n\nif let receivedData = KeyChainManager()?.load(key: \"com.appBundleID.password\") {\n    let data = String(decoding: receivedData, as: UTF8.self)\n    print(\"result: \", data)\n}\n```\n\n#### Store username value\n```python\n\nlet userNameString = textName?.text?.data(using: .utf8, allowLossyConversion: false) ?? Data()\nlet emailStatus = KeyChainManager()?.save(key: \"com.appBundleID.email\", data: userNameString)\n\n//Retrive data\n\nif let data = KeyChainManager()?.load(key: \"com.appBundleID.email\") {\n    let data = String(decoding: data, as: UTF8.self)\n    print(\"result: \", data)\n}\n```\n\n## NOTE\n```python\nReplace \"com.appBundleID\" with your project bundleID for KeyChain integration\nDefine the dataType in which you want to fetch the value and that’s the way you can get the stored value.\n```\n\n\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## License\nGenericLocalPersistence is [MIT-licensed](/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindinventory%2Fgenericlocalpersistence","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmindinventory%2Fgenericlocalpersistence","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindinventory%2Fgenericlocalpersistence/lists"}