Skip to content

If you want to be able to remotely change certain settings, this pod is for you. Inspired by Ground Control, but with zero dependencies.

License

Notifications You must be signed in to change notification settings

lewis-smith/MajorTom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MajorTom

Version License Platform

Remote configuration for iOS

Many developers don't realize that they are allowed to remotely control the behavior of their app (provided that the application isn't downloading any new code).

MajorTom gives you a dead-simple way to remotely configure your app, allowing you to add things like feature flags, impromptu A/B tests, or a simple "message of the day".

It's inpsired by GroundControl, and provides a single category on NSUserDefaults.

Client Code

UserDefaults().registerDefaultsWithURL(url: URL(string:"https://theprogressapp.com/wtw/defaults.plist")!)```

...or if you need callbacks for success/failure, and prefer not to listen for a NSUserDefaultsDidChangeNotification:

UserDefaults().registerDefaultsWithURL(url: URL(string:"https://theprogressapp.com/wtw/defaults.plist")!, success: { (response, dictionary) in
    print(response.debugDescription)
    print(dictionary.debugDescription)
}) { (response) in
    print(response.debugDescription)
}

Server Code

MajorTom asynchronously downloads and reads a remote plist file. This could be a static file or generated dynamically, like in the following examples:

Ruby

require 'sinatra'
require 'plist'

get '/defaults.plist' do
  content_type 'application/x-plist'

  {
    'Greeting' => "Hello, World",
    'Price' => 4.20,
    'FeatureXIsLaunched' => true
  }.to_plist
end

Python

from django.http import HttpResponse
import plistlib

def property_list(request):
plist = {
    'Greeting': "Hello, World",
    'Price': 4.20,
    'FeatureXIsLaunched': True,
    'Status': 1
}

return HttpResponse(plistlib.writePlistToString(plist))

Node.js

var plist = require('plist'),
express = require('express')

var host = "127.0.0.1"
var port = 8080

var app = express()

app.get("/", function(request, response) {
response.send(plist.build(
{
    'Greeting': "Hello, World",
    'Price': 4.20,
    'FeatureXIsLaunched': true,
    'Status': 1
}
).toString())
})

app.listen(port, host)

Static File

Or, simply create a plist file in Xcode and upload it to your webserver :)

Contact

Lewis Smith

License

MajorTom is available under the MIT license. See the LICENSE file for more info.

Apps

World Time Widget

About

If you want to be able to remotely change certain settings, this pod is for you. Inspired by Ground Control, but with zero dependencies.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published