{"id":17129009,"url":"https://github.com/michaelhenry/xconfigs","last_synced_at":"2025-06-14T21:39:08.822Z","repository":{"id":64915279,"uuid":"420067921","full_name":"michaelhenry/XConfigs","owner":"michaelhenry","description":"🛠Configs, a quick, simple and stylish solution for your remote and dev configurations.","archived":false,"fork":false,"pushed_at":"2025-06-04T18:51:24.000Z","size":2445,"stargazers_count":7,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-04T23:52:02.507Z","etag":null,"topics":["configurations","debug-tool","featureflags"],"latest_commit_sha":null,"homepage":"https://michaelhenry.github.io/XConfigs/documentation/xconfigs","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/michaelhenry.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-10-22T11:09:50.000Z","updated_at":"2025-02-11T10:25:44.000Z","dependencies_parsed_at":"2023-12-20T10:33:29.746Z","dependency_job_id":"fe662fd6-f863-4dfc-97bf-97bd98747748","html_url":"https://github.com/michaelhenry/XConfigs","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/michaelhenry/XConfigs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhenry%2FXConfigs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhenry%2FXConfigs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhenry%2FXConfigs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhenry%2FXConfigs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelhenry","download_url":"https://codeload.github.com/michaelhenry/XConfigs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhenry%2FXConfigs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259888188,"owners_count":22927072,"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":["configurations","debug-tool","featureflags"],"created_at":"2024-10-14T19:08:37.409Z","updated_at":"2025-06-14T21:39:08.793Z","avatar_url":"https://github.com/michaelhenry.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e🛠Configs\u003c/h1\u003e\n\u003cp align=\"center\"\u003eA quick, simple and stylish solution for your remote and dev configurations.\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://codecov.io/gh/michaelhenry/XConfigs\"\u003e\u003cimg alt=\"codecov\" src=\"https://codecov.io/gh/michaelhenry/XConfigs/branch/main/graph/badge.svg?token=WLH8VVA19I\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/michaelhenry/XConfigs/actions\"\u003e\u003cimg alt=\"test\" src=\"https://github.com/michaelhenry/XConfigs/actions/workflows/test.yml/badge.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/michaelhenry/XConfigs/releases/latest\"\u003e\u003cimg alt=\"release\" src=\"https://img.shields.io/github/v/release/michaelhenry/XConfigs.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://developer.apple.com/swift\"\u003e\u003cimg alt=\"Swift5.7\" src=\"https://img.shields.io/badge/language-Swift5.7-orange.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://developer.apple.com\"\u003e\u003cimg alt=\"Platform\" src=\"https://img.shields.io/badge/platform-iOS-green.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://developer.apple.com\"\u003e\u003cimg alt=\"Support\" src=\"https://img.shields.io/badge/support-iOS%2014+-red.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"LICENSE\"\u003e\u003cimg alt=\"license\" src=\"https://img.shields.io/badge/license-MIT-black.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n- [Introduction](#introduction)\n- [Getting Started](#getting-started)\n- [How to use](#how-to-use)\n- [Documentation](#-documentation)\n- [Example](#example)\n- [Other Related](#other-related)\n- [License](#license)\n\n---\n\n## Introduction\n\nAs part of software development process, we always need to see how our app will react depending on the different scenarios or configurations especially during testing. At the same time, it would be better if we can control some of app configurations on the fly, especially if there are unexpected things happened in our production environment, we can immediately enable or disable certain app functionality.\n\n## Getting Started\n\nInstall using SPM\n\n```swift\n.package(url: \"https://github.com/michaelhenry/XConfigs\", .upToNextMinor(from: \"1.0.0\")),\n```\n\n## How to use\n\n```swift\nlet kvProvider = SampleKeyValueProvider()\n\n// Register the AppConfigs and set which keyValueProvider and option to use. Note that `.allowInAppModification(InAppModificationOption)` option accepts a `KeyValueStore`.\nXConfigs.configure(with: AppConfigs.self, keyValueProvider: kvProvider, option: .allowInAppModification(.init(store: UserDefaults.standard)))\n```\n\nPlease note that on production build, it is recommend that the in-app modification is disabled (`option is set to readonly`), so XConfigs will just use either the value from the **keyValueProvider** or the default value assigned inside the property wrapper as fallback.\n\nEg.\n\n```swift\n#if DEBUG\n    XConfigs.configure(with: MockConfigs.self, keyValueProvider: kvProvider, option: .allowInAppModification(.init(store: UserDefaults.standard)))\n#else\n    XConfigs.configure(with: MockConfigs.self, keyValueProvider: kvProvider, option: .readonly)\n#endif\n```\n\n## 📄 Documentation\n\nPlease refer to [XConfigs's docs](https://michaelhenry.github.io/XConfigs/documentation/xconfigs/).\n\n## Example\n\nSimilar with logger tool such as [swift-log](https://github.com/apple/swift-log), You can simply create a single global variable or just a singleton, as long as the it conforms to [XConfigSpec](Sources/XConfigs/Protocols/XConfigsSpec.swift)ification and then use the `@XConfig` property wrapper inside it.\n\nIf you have some custom datatype, you can simply conform them to `RawStringValueRepresentable`. So the key thing is as long as a value can be represented as a string, it should be fine.\n\n```swift\nstruct AppConfigs: XConfigSpec {\n\n    @XConfig(key: \"isOnboardingEnabled\", defaultValue: false)\n    var isOnboardingEnabled: Bool\n\n    @XConfig(key: \"apiURL\", defaultValue: URL(string: \"https://google.com\")!)\n    var apiURL: URL\n\n    @XConfig(key: \"region\", defaultValue: .north)\n    var region: Region\n\n    @XConfig(key: \"maxRetry\", defaultValue: 10)\n    var maxRetry: Int\n\n    @XConfig(key: \"threshold\", defaultValue: 1)\n    var threshold: Int\n\n    @XConfig(key: \"rate\", defaultValue: 2.5)\n    var rate: Double\n}\n\nenum Region: String, CaseIterable, RawStringValueRepresentable {\n    case north\n    case south\n    case east\n    case west\n}\n```\n\nFor the complete example, please refer to the [Demo](Demo) project which auto-generated the screen(below) using the [AppConfigs.swift](https://github.com/michaelhenry/XConfigs/blob/main/Demo/Demo/AppConfigs.swift) config specification.\n\nhttps://user-images.githubusercontent.com/717992/213901399-d4429d63-83fb-4770-ac9c-a016e2128084.mp4\n\nhttps://github.com/michaelhenry/XConfigs/assets/717992/2b1ef692-647e-4fb0-aea4-aa4be25e9b31\n\n## Other Related\n\n### [Firebase Remote Config](https://firebase.google.com/docs/remote-config)\n\nYou can backed [XConfigs](https://github.com/michaelhenry/XConfigs) by [FirebaseRemoteConfig](https://firebase.google.com/docs/remote-config) by simply implementing the [KeyValueProvider](Sources/XConfigs/Protocols/KeyValueProvider.swift) protocol.\n\n\nExample:\n\n```swift\nimport FirebaseRemoteConfig\n\nstruct FirebaseKeyValueProvider: KeyValueProvider {\n\n    private let remoteConfig: RemoteConfig = {\n        let rconfig = RemoteConfig.remoteConfig()\n        let settings = RemoteConfigSettings()\n        settings.minimumFetchInterval = 0\n        rconfig.configSettings = settings\n        return rconfig\n    }()\n    \n    // Please refer to https://firebase.google.com/docs/remote-config/get-started?platform=ios\n    func fetch() {\n        remoteConfig.fetch { (status, error) -\u003e Void in\n            if status == .success {\n                print(\"Config fetched!\")\n                self.remoteConfig.activate { changed, error in\n                    // ...\n                }\n            } else {\n                print(\"Config not fetched\")\n                print(\"Error: \\(error?.localizedDescription ?? \"No error available.\")\")\n            }\n        }\n    }\n\n    // XConfigs KeyValueProvider protocol\n    func get\u003cValue\u003e(for key: String) -\u003e Value? where Value : RawStringValueRepresentable {\n        guard let rawValue = remoteConfig.configValue(forKey: key).stringValue, let value = Value(rawString: rawValue) else { return nil }\n        return value\n    }\n}\n\n```\n\n## LICENSE\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelhenry%2Fxconfigs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelhenry%2Fxconfigs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelhenry%2Fxconfigs/lists"}