Tuesday, September 3, 2013

Directly calling delegate's method in objective-c

Directly calling delegate's method in objective-c

I created a protocol that requires the class client to implement a method.
In the client class I also need to perform the same actions defined in
this method not only when the delegate calls it. I don't think it would be
a good idea to copy-paste the code, but I don't know either if it's a good
practice to call this method directly within the client class. I was
thinking that maybe the delegate methods should be called only by the
delegate.
Should I create a third method that it's called inside the delegate method
and when I need it? or, can I call the delegate method directly?

No comments:

Post a Comment