Latest 0.4
Homepage https://github.com/AllinMobile/AIMRemoteConfiguration
License MIT
Platforms ios 8.0, requires ARC
Dependencies libextobjc
Authors

AIMRemoteConfiguration allows you to define a list of colors used in the app in JSON file and fetch it from the internet. It works in an asynchronous way. The app starts normally, fetches all data in the background, and applies all styles on next start, so the user doesn’t see any loader at the beginning.

Usage

  • Add a category for UIColor:
    
    #import "RemoteConfiguration.h"

@implementation UIColor (list)

  • (UIColor *)backgroundColor {
    return [RemoteConfiguration colorWithName:@"background"]?: [UIColor whiteColor];
    }

  • (UIColor *)textColor {
    return [RemoteConfiguration colorWithName:@"text"]?: [UIColor blackColor];
    }

@end

- Setup in `AppDelegate.m`
```objective-c
#import "AppDelegate.h"
#import "RemoteConfiguration.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [RemoteConfiguration setup];
    return YES;
}
 @end
  • Add theme.json file with default config for your app:
{
    "colors": {
        "background": "##d35400",
        "text": "#000000"
    }
}
  • Add config to Info.plist:

    • themeFileName – name of default config without extension (theme in our example)
    • themeRemotePath – path to remote config (https://allinmobile.github.io/AIMRemoteConfiguration/remote_theme.json in our example) remember about HTTPS
  • Use in the app, i.e:
#import "ViewController.h"
#import "UIColor+list.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *quotation;
@property (weak, nonatomic) IBOutlet UILabel *citation;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor backgroundColor];
    self.quotation.textColor = [UIColor textColor];
    self.citation.textColor = [UIColor textColor];
}

@end

Installation

Use the CocoaPods.

Add to your Podfile

pod 'AIMRemoteConfiguration'

and then call

pod install

and import

#import "RemoteConfiguration.h"

Example

Check folder Example for a simple application with AIMRemoteConfiguration integrated.

Check the full video

Latest podspec

{
    "name": "AIMRemoteConfiguration",
    "version": "0.4",
    "summary": "Remote configuration for your app by http://allinmobile.co",
    "homepage": "https://github.com/AllinMobile/AIMRemoteConfiguration",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Maciej Gad": "https://github.com/MaciejGad"
    },
    "social_media_url": "https://twitter.com/maciej_gad",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/AllinMobile/AIMRemoteConfiguration.git",
        "tag": "v0.4"
    },
    "source_files": "Sources/*.{h,m}",
    "requires_arc": true,
    "dependencies": {
        "libextobjc": []
    }
}

Pin It on Pinterest

Share This