Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integration of a NSObject+Mediator category #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

treppa
Copy link

@treppa treppa commented Feb 5, 2014

The following changes have been made

  • Added the NSObject+Mediator category. This enables any class to communicate with the pureMVC framework using method signatures from the IMediator protocol. Additionally, the category provides -(void)register and -(void)unregister methods for registering and unregistering ViewControllers / IMediators with the View.
    Note: Only ViewControllers or other classes representing the presentation layer should implement the NSObject+Mediator category.
  • the Mediator class is being removed
  • (void)notifyObserver:(id)notification now ignores the leak warning from xcode
  • The method signatures -(id)viewComponent and code>-(void)setViewComponent:(id)viewComponent have been removed from the IMediator protocol since they are redundant now.
  • The method +(NSString *)NAME within Proxies and NSObject+Mediator now return their classnames using NSStringFromClass([self class])
  • documentation updated using doxygen 1.8.6
  • header files updated
  • code is converted to ARC

Note: Code that uses previous versions of pureMVC are not compatible with these changes.

Refactoring your code

  • import the NSObject+Mediator category within all ViewController classes, that need to receive or send Notifications from or to pureMVC
  • refactor all Mediator methods to your UIViewController
  • remove all Mediators and their references including their Facade registrations in your entire code
  • get rid of your Mediator / UIViewController communication code, in case you have any
  • register / unregister your ViewControllers with the Facade like:
- (void)viewDidLoad {
    [super viewDidLoad];

    // register your ViewController / IMediator with the View
    [self register];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

    // unregister your ViewController / IMediator from the View
    [self unregister];
}
  • register / retrieve a proxy like:
    //register proxy with the Model
    [self.facade registerProxy:[TestProxy proxy]];

    // retrieve a proxy from the Model
    id testProxy = [facade retrieveProxy:[TestProxy NAME]];

Examples

A description including visual diagrams and examples for ios and osx can be found at:
http://www.reppa.net/puremvc-fur-ios-und-osx/

- removed Mediator .h and .m
- added NSObject+Mediator caregory
- documentation updated
- headers updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant