I have two view controllers VC1 and VC2. I pass a value from VC1 to VC2 through prepareForSegue method. and when I receive that value in VC2 I multiply it by 10. Then after multiplying that value by 10 in VC2 I want to return it back to VC1.
to solve this issue, I would use Delegate
. so, I created DelegateDataProcessor
class
but I do not know how to call the required method processingDone
in the method startProcessingValue
please have a look at the code below
** DelegateDataProcessor.h**:
#import <Foundation/Foundation.h>
@protocol ProtocolDataProcessor <NSObject>
@required
- (void) processingDone;
@end
@interface DelegateDataProcessor : NSObject{
id <ProtocolDataProcessor> _delegate;
}
@property (nonatomic, strong) id delegate;
-(void) startProcessingValue: (NSInteger) valueToBeProcessed;
@end
** DelegateDataProcessor.m**:
#import "DelegateDataProcessor.h"
@implementation DelegateDataProcessor
-(void) startProcessing:(NSInteger) value {
value = value * 10;
//How to call the method `processingDone` here
}
@end