Latest 0.1.0
Homepage https://github.com/saiten/ObjectiveMonkey
License MIT
Platforms ios 8.0
Frameworks JavascriptCore
Authors

Hot patch for iOS App

Requirements

  • iOS 8 or Later

Installation

ObjectiveMonkey is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "ObjectiveMonkey"

Usage

Setup

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // apply remote patch
    ObjectiveMonkey.default().patch(from: URL(string: "https://example.com/patch.js")!)
    return true
}

Patch code

problem code

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    @IBAction func pressButton(sender: Any) {
        assert(false) // fail anyway
    }
}

patch script

$p.addPatch('ViewController', 'pressButtonWithSender:', (
  self,  // OMKObjcBox<ViewController *>
  sender // OMKObjcBox<id>
) => {
  $p.consoleLog("patched pressButton");

  // change background color
  let UIColor = $p.NSClassFromString('UIColor'); // -> OMKObjcBox<Class>
  let color = UIColor.call('colorWithRed:green:blue:alpha:', Math.random(), Math.random(), Math.random(), 1.0); // -> OMKObjcBox<UIColor *>
  self.call('view').call('setBackgroundColor:', color);
});

Author

saiten, [email protected]

License

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

Latest podspec

{
    "name": "ObjectiveMonkey",
    "version": "0.1.0",
    "summary": "Hot patch for iOS App",
    "description": "Hot patch for iOS App",
    "homepage": "https://github.com/saiten/ObjectiveMonkey",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "saiten": "[email protected]"
    },
    "source": {
        "git": "https://github.com/saiten/ObjectiveMonkey.git",
        "tag": "0.1.0"
    },
    "social_media_url": "https://twitter.com/saiten",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "ObjectiveMonkey/**/*",
    "frameworks": "JavascriptCore"
}

Pin It on Pinterest

Share This