Mission Control – Remote Config Utility for iOS, OSX, …

swift

Have you ever wished you could change some config parameter for your app without deploying a new version? Of course you have! Wouldn’t it be great if you had whole config for your app in the cloud and change it as you see fit? Of course it would! Well, go ahead, just put some config somewhere in the cloud and MissionControl will take care of the rest for you.

This code will get you started:

// Local Config 
let config: [String : AnyObject] = [
    "Ready" : true,
    "LaunchForce" : 0.21
]

// Remote Config Endpoint
// Format the config as a JSON payload
let remoteURL = NSURL(string: "http://appculture.com/mission-control")!

// Initialize Misson Control.
// Settings from the remote config will overwrite the local config
MissionControl.launch(localConfig: config, remoteConfigURL: remoteURL)

// Get config values using helper accessors
let ready = ConfigBool("Ready", fallback: false)
let numberOfSeconds = ConfigInt("CountdownDuration", fallback: 10)
let launchForce = ConfigDouble("LaunchForce", fallback: 0.5)
let color = ConfigString("ReadyColor", fallback: "#7ED321")

Mission Control →

At work we build things like in all of our apps. Last year – for a Hybrid App named “De Allesweter” – we did exactly the same thing using JavaScript. That’s how we roll.

Implementing this yourself is fairly easy: fetch() the remote config, and merge it with your local one using Object.assign().

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.