Inject code in math o file

How can I inject, edit objective code or assembly code to the main executable in ipa file. Thanks in advance.

I just know inject code by Dynamic Framework. But I seen some people edit directly in the main executable file.