MBEvents Class Reference

Inherits from NSObject
Declared in MBEvents.h

Overview

Provides a simple interface for posting NSNotification events of various types.

Posting events

+ postEvent:

Posts a notification event.

+ (void)postEvent:(nonnull NSString *)event

Parameters

event

The name of the event to post.

Declared In

MBEvents.h

+ postEvent:withSuffix:

Posts a notification event by constructing the event name “event:suffix”.

+ (void)postEvent:(nonnull NSString *)event withSuffix:(nullable NSString *)suffix

Parameters

event

The prefix of the event name to post.

suffix

The suffix of the event name to post.

Declared In

MBEvents.h

+ postEvent:withObject:

Posts a notification event containing the given object parameter.

+ (void)postEvent:(nonnull NSString *)event withObject:(nullable id)obj

Parameters

event

The name of the event to post.

obj

The object to post with the event. This value will be available in the object property of the NSNotification created for the event.

Declared In

MBEvents.h

+ postEvent:withUserInfo:

Posts a notification event containing the given userInfo parameter.

+ (void)postEvent:(nonnull NSString *)event withUserInfo:(nullable NSDictionary *)userInfo

Parameters

event

The name of the event to post.

userInfo

The user info dictionary to post with the event. This value will be available in the userInfo property of the NSNotification created for the event.

Declared In

MBEvents.h

+ postEvent:fromSender:

Posts a notification event along with the object instance sending the event.

+ (void)postEvent:(nonnull NSString *)event fromSender:(nullable id)sender

Parameters

event

The name of the event to post.

sender

The sender of the event. This object will be available in the object property of the NSNotification created for the event.

Declared In

MBEvents.h

Constructing event-related names

+ name:withSuffix:

Constructs a string for an event-related name with the given suffix.

+ (nullable NSString *)name:(nullable NSString *)name withSuffix:(nullable NSString *)suffix

Parameters

name

The name to use for the root of the returned string. If nil, this method returns nil.

suffix

The optional suffix to apply to name. If nil, this method returns name.

Return Value

If name and suffix are both non-nil, the concatenation of name, : and suffix is returned. Otherwise, the value of the name parameter is returned.

Some notification names are parameterized, based on the name of components (or other objects) at runtime. These methods return construct and return event names.

Declared In

MBEvents.h

+ postMemoryWarning

Posts an artificial memory warning using the event name contained in the UIApplicationDidReceiveMemoryWarningNotification constant.

+ (void)postMemoryWarning

Discussion

This can be used to cause various application-wide caches to reduce their non-persistent memory footprints.

Declared In

MBEvents.h