iOS design mode-responsibility chain
Schematic diagram
Description
In the chain of responsibility, many objects are linked together by each object's reference to its next generation. The request is passed on this chain until an object on the chain decides to process the request. The client making this request does not know which object on the chain is ultimately processing the request, which allows the system to reorganize and assign responsibilities dynamically without affecting the client.
Source
Https://github.com/YouXianMing/ChainOfResponsibilityPattern
////ChainOfResponsibilityProtocol.h//Chainofresponsibilitypattern////Created by youxianming on 15/10/27.//copyright©2015 year Zipeiyi. All rights reserved.//#import<Foundation/Foundation.h>@protocolChainofresponsibilityprotocol <NSObject>/** * Set Replacement Object * * @param successor successor*/- (void) Setsuccessor: (ID<ChainOfResponsibilityProtocol>) successor;/** * return to Replacement Object * * @return successor*/- (ID<ChainOfResponsibilityProtocol>) successor;/** * Processing Requests * * @param request Requests*/- (void) Handlerrequest: (ID) request;@end
Details
iOS design mode-responsibility chain