快速设置环境变量

我试图了解如何快速设置环境变量

I went through following doc: Xcode Custom Environment Variables

我正在构建一个本机应用程序,对快速语法一无所知。

As suggested in the doc, I created the environment variable named google_maps

By following one of the docs I did something like this: [GMSServices provideAPIKey:@"AIzaSyCFyS2_cj15FCARAz8"]; where AIzaSyCFyS2_cj15FCARAz8 should be the value of google_mapskey but I am still not sure how to replace it.

另外,在本文中,作者提到了类似的内容

enum EnvironmentVariables: String {
   case verbose_level   var value: String {
      let v = ProcessInfo.processInfo.environment[rawValue]
      return v ?? “”
   }
}// Use case
if EnvironmentVariables.verbose_level.value == "verbose" {
   print("debug info")
}

然后重点介绍了使用以上代码段的问题

  • 因为环境键是全局的,所以我们应该为它们命名空间,以防止覆盖其他一些值。

有人也可以解释以上几点吗?

  • 难以添加新案例