Structures

The following structures are available globally.

  • A type-safe interface to variables in the environment from which the process was launched.

    See more

    Declaration

    Swift

    @dynamicMemberLookup
    public struct Environment
  • A property wrapper that uses the specified environment variable name for property access and backing storage.

    The following example shows how to use the EnvironmentVariable property wrapper to expose static properties backed by enviornment variables ("HOST" and "PORT").

    enum ServerSettings {
        @EnvironmentVariable(name: "HOST")
        static var host: URL?
    
        @EnvironmentVariable(name: "PORT", defaultValue: 8000)
        static var port: Int
    }
    
    See more

    Declaration

    Swift

    @propertyWrapper
    public struct EnvironmentVariable<T>