objective c - forwardInvocation vs class_addMethod -
in implementation, have choice of using class_addmethod create new methods in runtime, or can rely on forwardinvocation/nsproxy. when both approaches available solutions, way prefer , how determine?
i prefer class_addmethod
.
- because much faster
forwardinvocation
(search method list, try forwardtarget, creatensinvocation
, last attempt resolve selector) - it more clear add new method rather handle dynamical method call in 1 place.
Comments
Post a Comment