Referring to Environment Variables in Swift

Viewed 44246

Does anybody know how I can grab an environment variable in Swift?

5 Answers

A Vapor specific solution:

From the code which Vapor automatically A Vgenerates as a project template:

let variable = Environment.get("VARIABLE") ?? "or-the-dafault"
Related