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

Dependencies

Used By

Total: 0

Releases

2.0.1 - 2019-09-13 20:17:25

Fixes Linux builds

2.0 - 2019-09-01 10:02:52

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

1.0 - 2019-08-22 17:26:15

Initial release