Latest 1.1.1
Homepage https://github.com/delannoyk/ConfigurationKit
License MIT
Platforms ios 8.0, osx 10.9, tvos 9.0, requires ARC
Authors

Build Status
Carthage compatible
CocoaPods Compatible
Platform iOS | tvOS | OSX
Contact
codecov.io

Have you ever been in a situation where you submitted a build on the App Store with
wrong API Keys, environment URLs and such? Well, ConfigurationKit is here to help.

Introduction

A Configuration is basically a Dictionary that is supposed to contain
everything related to configuring your app (it can be anything: API keys, URLs, …).
This Configuration refreshes itself and alerts you of any change by
downloading a new version of your file upon events that you can configure:

  • App startup,
  • App enters foreground,
  • At defined time intervals,
  • A custom EventProducer.

A refresh cycle can be done thanks to 3 protocols:

  • An URLBuilder servers the purpose of building a valid NSURLRequest
    when it’s needed. Using this allows you to configure everything you can use to
    call your server (HTTP Headers, Cookies, Signed URL, …).
  • A Parser transforms raw NSData into a usable Dictionary.
  • And an Encryptor because security matters for these kinds of data. It lets
    you decrypt data coming from your server in order to be parsed right after.

Of course, you will probably want to have an initial configuration (hardcoded or
bundled in your application resources) and use it, but you will also want to
use the last configuration available. That is why Cacher has been introduced
to the framework: in order to cache the latest version of the configuration.
Again, because security matters, another Encryptor can be used to encrypt data
before calling any method of the Cacher.

Usage

TODO

Installation

CocoaPods

Add ConfigurationKit to your Podfile:

pod 'ConfigurationKit'

Carthage

Add ConfigurationKit to your Cartfile:

github "delannoyk/ConfigurationKit"

Source

Add sources/ConfigurationKit/**/*.swift to your project.

Default implementation

ConfigurationKit provides default implementation for most of the protocols
implementation needed by a Configuration.

Cacher

FileCacher

A FileCacher is a Cacher implementation that saves data in multiple files.

You can create a FileCacher by initializing it with the path to a directory
where to save files in and by giving it options used to save files.

The only option right now is .IncludeInBackup and allows you to define that
new configuration should be included in application backup (iTunes and iCloud).

URLBuilder

SimpleURLBuilder

A SimpleURLBuilder is an URLBuilder implementation that uses a static URL in
order to create the NSURLRequest.

Parser

PListParser

A PListParser is an implementation of Parser that reads a configuration from
plist data.

FlatJSONParser

A FlatJSONParser is an implementation of Parser that reads a configuration
from a JSON file that can be represented as a [String: String]. For example:

{
    "key1": "value1",
    "key2": "value2",
    "key3": "value3"
}

EventProducer

ApplicationEventProducer

The ApplicationEventProducer is available on iOS and tvOS. It produces an
event when the application enters foreground back from background.

StopWatchEventProducer

A StopWatchEventProducer generates events as a repeating timer would.

TimedEventProducer

A TimedEventProducer generates events a specific dates and times.

Latest podspec

{
    "name": "ConfigurationKit",
    "version": "1.1.1",
    "license": {
        "type": "MIT"
    },
    "homepage": "https://github.com/delannoyk/ConfigurationKit",
    "authors": {
        "Kevin Delannoy": "[email protected]"
    },
    "summary": "ConfigurationKit is a framework that helps you to always have right configuration for your apps.",
    "source": {
        "git": "https://github.com/delannoyk/ConfigurationKit.git",
        "tag": "1.1.1"
    },
    "source_files": "sources/ConfigurationKit/**/*.swift",
    "platforms": {
        "ios": "8.0",
        "osx": "10.9",
        "tvos": "9.0"
    },
    "osx": {
        "exclude_files": "sources/ConfigurationKit/event/ApplicationEventProducer.swift"
    },
    "requires_arc": true
}

Pin It on Pinterest

Share This