ConfigProperty

public protocol ConfigProperty

The ConfigProperty protocol is registered automatically, and load the configuration properties from property files.

When injecting an object that inherits this protocol, it will always inject the newly created object(like Scope.prototype). Therefore, recommended implementing as struct-type.

For example, this ServerConfig struct injects data corresponding to the “server” key of the property.

struct ServerConfig: ConfigProperty {
    let target: String = "server"

    let url: String
}
  • The target path to load from the configuration properties.

    Declaration

    Swift

    var target: String { get }