I already read some post about the why use embedded script language but I want to ask when to use it.
- Code completion. If I want to call some
UIKitmethod froom JS, I often have to check the document for its name compare to just type first few letters and let Xcode complete it for me in ObjC.
- All the benefit of static typed language. ObjC is static typed and dynamic typed language so compiler can do lots type checking for me when possible.
- C binding to JS not ready yet (this required to parse header and generate code to expose C function, enum, struct, etc)
- More natural to write ObjC when dealing with ObjC methods. (e.g. in JS write code like
view.setEdit_animated(true, true)compare to ObjC
[view setEdit:YES animated:YES]
But I feel I should write more JS code so I can take the benefit scripting language (e.g. replace methods with bug fixes at runtime)
I am not sure which part of my app should be written in JS and which part should be written in ObjC. Any advice?
Also any design pattern can be used for embedded script language?