55
50

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Xcode, Swiftで環境変数を設定し、参照する方法

Posted at

設定

[1] Product > Scheme > Edit Scheme を選択

[2] Environment Variablesの項目で任意のKeyとValueを設定

environment_variable_1.png

参照

  
        let env = NSProcessInfo.processInfo().environment
        if let value = env["設定したKey"] as? String {
            println(value) //=> 1234
        } else {
            // Environment variable not set (or not a string)
        }
55
50
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
55
50

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?