Swiftpack.co - Package - nikstar/Env

Env

@dynamicMemberLookup interface for environment variables.

Swift 5 Platforms: macOS, Linux Swift Package Manager compatible releases MIT license

Add to your project via Swift package manager:

        .package("https://github.com/nikstar/Env.git", from: "2.0.0")

Example

guard let home = Env.HOME else { return }
Env.PATH! += ":\(home)/bin"

Unsetting varibles:

Env.LC_LOCALE = nil

Throwing access:

do {
    let v = try Env.get("NOTAVAR")
} catch {
    print(error) // "environment variable missing: NOTAVAR"
}

Github

link
Stars: 0
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

v2.0.1 - Sep 13, 2019

Fixes Linux builds

v2.0.0 - Sep 1, 2019

  • Switched to static subscript to simplify API
  • Added throwing access with Env.get

v1.0.0 - Aug 22, 2019

Initial release