Swiftpack.co -  nikstar/Env as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
nikstar/Env
@dynamicMemberLookup interface for environment variables
.package(url: "https://github.com/nikstar/Env.git", from: "v2.0.1")

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
Last commit: 1 year ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

2.0.1
1 year ago

Fixes Linux builds

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API