Classes

The following classes are available globally.

  • A one-stop shop to aggregate configuration properties from different sources, including command-line arguments, environment variables, files, URLs and raw objects into a single configuration store. Once the store has been populated configuration data can be accessed and retrieved for an individual value, or multiple values, resources can also be removed.

    Usage Example

    import Configuration
    
    let manager = ConfigurationManager()
    manager.load(file: "config.json").load(.environmentVariables)
    

    To get configuration values after they have been loaded, use:

    manager["path:to:configuration:value"]
    

    The configuration store is represented as a tree, where the path elements in keys are delimited by colons (:). The value returned is typed as Any?, therefore it’s important to cast the value to the type you want to use.

    When aggregating configuration data from multiple sources, if the same configuration key exists in multiple sources the one most recently loaded will override those loaded earlier. In the example below the value for foo is now baz because ["foo": "baz"] was more recently loaded than ["foo": "bar"]. The same behaviour applies to all other load functions.

    manager.load(["foo": "bar"]).load(["foo": "baz"])
    
    See more

    Declaration

    Swift

    public class ConfigurationManager
  • Default JSON deserializer implementation.

    Deserializes JSON formatted data using Foundation’s JSONSerialization class.

    See more

    Declaration

    Swift

    public class JSONDeserializer : Deserializer
  • Default PLIST deserializer implementation.

    Deserializes PLIST formatted data using Foundation’s PropertListSerialization class.

    See more

    Declaration

    Swift

    public class PLISTDeserializer : Deserializer