Latest 1.0.1
Homepage https://github.com/nebiros/JIMEnvironments
License BSD
Platforms ios , requires ARC
Authors

A simple solution to handle environment specific settings. It uses the current Build Configuration name to retrieve settings from a Plist file.

Installation

Via CocoaPods

pod "JIMEnvironments", "~> 1.0.0"

Or, just drag the class files into your project, also the Environments.plist file, there’s no need to create an instance of it, it’s a self-instantiating singleton.

Setup

  1. Add a new row to your Info.plist application file.
  2. Set this key JIMEnvironmentsTargetBuildConfigurationName and this value $(CONFIGURATION).
  3. Create a new Plist file into your project, name it as Environments.
  4. Per default, Xcode creates two build configurations, Debug and Release, so add two dictionaries, one for Debug and one for Release.

Plist Example

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Debug</key>
    <dict>
        <key>ApiUrl</key>
        <string>https://dev.example.com/api</string>
    </dict>
    <key>Release</key>
    <dict>
        <key>ApiUrl</key>
        <string>https://production.example.com/api</string>
    </dict>
</dict>
</plist>

Usage

Add as many keys you want for each build configuration dictionary, then, you can access each one this way:

[JIMEnvironments sharedInstance].environment[@"ApiUrl"]

Latest podspec

{
    "name": "JIMEnvironments",
    "version": "1.0.1",
    "summary": "A simple solution to handle environment specific settings.",
    "description": "                    A simple solution to handle environment specific settings.n                    It uses the current Build Configuration (Debug, Release...) name to retrieve settings from a Plist file.n",
    "homepage": "https://github.com/nebiros/JIMEnvironments",
    "license": {
        "type": "BSD",
        "file": "LICENSE"
    },
    "authors": {
        "Juan Felipe Alvarez Saldarriaga": "[email protected]"
    },
    "social_media_url": "http://twitter.com/nebiros",
    "platforms": {
        "ios": null
    },
    "source": {
        "git": "https://github.com/nebiros/JIMEnvironments.git",
        "tag": "1.0.1"
    },
    "source_files": "JIMEnvironments/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This