PureMVC Architects Lounge

PureMVC Manifold => Standard Version => Topic started by: saad on December 28, 2010, 05:57:10



Title: Using multiple instances of the same Mediator
Post by: saad on December 28, 2010, 05:57:10
http://blog.loadvars.com/2009/07/07/using-multiple-instances-of-the-same-mediator-in-puremvc/

In view of the above post, how to accomplish the same for Objective-C Port?


Title: Re: Using multiple instances of the same Mediator
Post by: puremvc on December 29, 2010, 09:12:49
The mediator just has to have a unique name. In the demo you linked to, that name is a concatenation of the view component's id property and the mediator's NAME constant. Does your view component not have the equivalent of an id property?

-=Cliff>


Title: Re: Using multiple instances of the same Mediator
Post by: saad on January 10, 2011, 04:43:59
Hi:

I worked it out using following strategy,

@implementation CigaretteMediator

+ (NSString *)NAME {
    return @"CigaretteMediator";
}

- (void)initializeMediator {
    self.mediatorName = [[CigaretteMediator NAME] stringByAppendingString:[viewComponent name]];
}

in my view component had to create a function and property ([viewComponent name]), for setting and retrieving a unique name, though I was looking for a built-in property such as what Cliff suggest like id something, is there something like that we can set and get a built-in property programmatically for each UIViewController