Sha256: b5b33f2914df1af2d1ed0822e3824a1ddcdcc3bb66a915898ff565f48df8e33b

Contents?: true

Size: 1.63 KB

Versions: 34

Compression:

Stored size: 1.63 KB

Contents

//
//  Observer.m
//  PureMVC_ObjectiveC
//
//  PureMVC Port to ObjectiveC by Brian Knorr <brian.knorr@puremvc.org>
//  PureMVC - Copyright(c) 2006-2008 Futurescale, Inc., Some rights reserved.
//

#import "Observer.h"


@implementation Observer

@synthesize notifyMethod, notifyContext;

/**
 * Static Convienence Constructor.
 */
+(id)withNotifyMethod:(SEL)notifyMethod notifyContext:(id)notifyContext {
	return [[[self alloc] initWithNotifyMethod:notifyMethod notifyContext:notifyContext] autorelease];
}

/**
 * Constructor. 
 * 
 * <P>
 * The notification method on the interested object should take 
 * one parameter of type <code>INotification</code></P>
 * 
 * @param notifyMethod the notification method of the interested object
 * @param notifyContext the notification context of the interested object
 */
-(id)initWithNotifyMethod:(SEL)_notifyMethod notifyContext:(id)_notifyContext {
	if (self = [super init]) {
		self.notifyMethod = _notifyMethod;
		self.notifyContext = _notifyContext;
	}
	return self;
}

/**
 * Compare an object to the notification context. 
 * 
 * @param object the object to compare
 * @return boolean indicating if the object and the notification context are the same
 */
-(BOOL)compareNotifyContext:(id)object {
	return [object isEqual:notifyContext];
}

/**
 * Notify the interested object.
 * 
 * @param notification the <code>INotification</code> to pass to the interested object's notification method.
 */
-(void)notifyObserver:(id<INotification>)notification {
	[notifyContext performSelector:notifyMethod withObject:notification];
}

-(void)dealloc {
	self.notifyMethod = nil;
	self.notifyContext = nil;
	[super dealloc];
}


@end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
appjam-0.1.8.11 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.10 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.9 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.8 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.7 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.6 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.5 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.4 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.3 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.2 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.1 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.pre13 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.pre12 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.pre11 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.pre10 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.pre9 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.pre7 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.pre6 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m
appjam-0.1.8.pre5 lib/appjam/generators/project/Classes/org/puremvc/objectivec/patterns/observer/Observer.m