Swiftpack.co -  patgoley/Configurate as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
patgoley/Configurate
Build stackable configuration objects for Swift applications.
.package(url: "https://github.com/patgoley/Configurate.git", from: "2.0")

Configurate

CocoaPods CocoaPods Travis codecov

Configurate is a package for building layered Config objects, which are essentially stacks of key-value collections. Configs are protocol based, so they can be implemented by any source that can provide a value for a given key.

Example

let config = Config(ProcessInfo.processInfo)            // Searches environment variables
    .include(UserDefaults.standard)                     // Searches a UserDefaults instance
    .include(try! ConfigFile(url: URL("config.json")))  // Searches a JSON or Plist config file, must result in [String: Any]
    .include(["key": "overrideValue"])                  // Searches a [String: Any] Dictionary
    
let value: String? = config["someKey"]                  // Infers expected return type

The key value collections included in the Config are searched in reverse order, so that values from one collection override values from previously added collections.

Installation

Swift Package Manager

import PackageDescription

let package = Package(
    name: "MyPackage",
    dependencies: [
        .Package(url: "https://github.com/patgoley/Configurate.git", majorVersion: 2),
    ]
)

Cocoapods

pod 'Configurate', '~> 2.0'

License

MIT

GitHub

link
Stars: 4
Last commit: 3 years ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

2.0
3 years ago

API improvements.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API