This pod is used by
SHFoundationAdditions
as part of many components covering to plug the holes missing from Foundation, UIKit, CoreLocation, GameKit, MapKit and other aspects of an iOS application's architecture.
SHObjectUserInfo is a category on top of NSObject to allow userInfo dictionary without swizzling. It's built on top of NSMapTable that works with weakToStrong references between an object and its userInfo.
No developer psyches were harmed or killed for this. I've noticed other similar libraries all swizzle like there is no tomorrow. If the API can remains the same without Swizzle, then don't Swizzle.
All in all; 50 loc for userInfo
pod 'SHObjectUserInfo'
Put this either in specific classes or your project prefix file
#import "NSObject+SHObjectUserInfo.h"
or
#import "SHObjectUserInfo.h"
myObjectThatInheritedFromNSObject.sh_userInfo = [@{@"myKey" : mYValue} mutableCopy];
If you're using SHSegueBlocks
[self SH_performSegueWithIdentifier:@"unwinder" withUserInfo:@{@"date" : [NSDate date]}];
In the destinationViewController
self.myDate = self.SH_userInfo[@"date"];
or
[self SH_performSegueWithIdentifier:@"push"
andDestionationViewController:^(UIViewController * theDestinationViewController) {
theDestinationViewController.SH_userInfo = myDictionary
}];
If you end up using SHObjectUserInfo in a project, I'd love to hear about it.
email: seivan.heidari@icloud.com
twitter: @seivanheidari
SHObjectUserInfo is © 2013 Seivan and may be freely
distributed under the MIT license.
See the LICENSE.md
file.