I have a bunch of drawing code (primitive drawing, mostly bezier path drawing calls) thats stored in a couple of files and the draw code runs to about a few hundred lines. I wanted to know if its possible to read this code from a file and execute it at a particular point in my program (maybe a draw method of a UIView), much like what we do with shaders in openGL 2.0.
I want to be able to use this code to do my drawing but i dont want to copy the drawing code into the UIView class I'm using because it becomes cumbersome to maintain and hardly readable, plus i have many such files!
I know that i can read the contents of a file using existing frameworks, but is there something that will allow me to execute the read contents of the file where i need this drawing code to run?
Any ideas/help is appreciated!