unlockagency/natrium
Natrium is part of the **[E-sites iOS Suite](https://github.com/e-sites/iOS-Suite)**.
Swift
Just add Natrium.swift (from the designated location, see installation guide) to your project's target (do not copy).
Configuration
Configuration documentation can be found here.
Usage
The example .natrium.yml as shown above, will result in the following Config.swift file:
import Foundation
/// Natrium.swift
/// Autogenerated by natrium
///
/// - see: https://github.com/e-sites/Natrium
enum Natrium {
enum Environment: String {
case staging = "Staging"
case production = "Production"
}
enum Configuration: String {
case debug = "Debug"
case release = "Release"
case adhoc = "Adhoc"
}
enum Config {
static let environment: Natrium.Environment = .staging
static let configuration: Natrium.Configuration = .debug
static let testVariableDouble: Double = 1.0
static let testVariableString: String = "debugString"
static let testVariableBoolean: Bool = false
static let testVariableInteger: Int = 125
static let testArray: [String] = [ "StagingFoo", "StagingBar" ]
}
}It can be used like so:
class MainViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
print("bundle identifier: \(Bundle.main.bundleIdentifier!)")
print("environment: \(Natrium.Config.environment)")
}
}Result:
bundle identifier: com.esites.app.staging
environment: StagingDevelopment
Run
make xcodeprojand open Natrium.xcodeproj
Advanced
Logging
In the Pods/Natrium/bin/ folder you can find natrium.log with the logs of the previous build. It might help you with debugging.
Environment variables
If you place .env in the root of your project. Natrium will use that fill to add environment variables to your already existing environment variables. The .env file should have to following format:
KEY=VALUEfor instance:
PRODUCTION_SECRET_API_TOKEN=3489uierhjkfbnvcx
STAGING_SECRET_API_TOKEN=iujk9qijs41This way you can use #env(PRODUCTION_SECRET_API_TOKEN) in your .natrium.yml file.
For CI/CD pipelines you can simply add those environment variables to your build pipeline (in travis or buddybuild for instance).
But if you want to use it for local (debug) builds, this file can be helpful. ⚠️ Don't forget to add .env to your .gitignore
Package Metadata
Repository: unlockagency/natrium
Default branch: main
README: README.md