CocoaPods-Keys is a way of removing API keys and secrets from your code. Securing application keys can be difficult, CocoaPods-Keys abstracts away this difficulty for you. When you add keys and associated values using CocoaPods-Keys, the key names are stored in ~/.cocoapods/keys/ and the associated values in the OS X keychain.
CocoaPods-Keys is a Ruby gem and can be installed by running:
$ gem install cocoapods-keys
In Ruby, it is common to use Bundler to manage gem dependencies. If you don’t already have Bundler installed you can install it by running:
$ gem install bundler
Once you have Bundler installed, you can create a Gemfile to manage dependencies by running:
$ bundle init
Open the Gemfile in a text editor and edit as follows:
You define what keys you want inside your Podfile and Keys detects whether the key has been set yet or not, if not you will be prompted to provide the key value when you run `pod install`.
When CocoaPods-Keys does its stuff it generates an Objective-C class and stores it in ~/.cocoapods/keys/. To use the keys in your project you first need to import the keys module and you will then be able to access your keys as follows:
let keys = ProjectNameKeys()
print("key value \(keys.SampleKey)")