Referring to Environment Variables in Swift January 17, 2023 by Tarik Swift 3 and up: import Foundation if let value = ProcessInfo.processInfo.environment["KEY"] { ... }