1

I am building an app that exposes a dictionary to a WebView with JavaScriptCore. It's options for the content of the page. It is a dictionary with multiple (and differing) keys and the values can also be dictionaries or array (in addition to strings, etc).

With non-dictionary values it's straight forward, simply overriding the setter, however, that isn't appropriate here. When the value changes I need to then save it, but I am having trouble with nested values.

I have looked in to KVO, however, this only allows a single key. This question seems promising, but as I am using JavaScriptCore to 'convert' my dictionary to a JavaScript object I may need to keep an instance of NSDictionary. Changing all the child dictionaries and arrays would be required too which is far from ideal.

I could try looping over each key and observing each on and child keys, but probably won't work with new keys.

If there is a method in the (horrendously documented) JavaScriptCore which might help that would be excellent too.

Oliver Cooper
  • 849
  • 7
  • 20

0 Answers0