Latest 1.2.2
Homepage https://github.com/seivan/SHObjectUserInfo
License MIT
Platforms ios 6.0, osx 10.8, requires ARC
Authors

CI Status
Version
Platform
License

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.

Overview

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.

Swizzle & Junk free

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

Installation

pod 'SHObjectUserInfo'

Setup

Put this either in specific classes or your project prefix file

#import "NSObject+SHObjectUserInfo.h"

or

#import "SHObjectUserInfo.h"

Usage

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

  }];

Contact

If you end up using SHObjectUserInfo in a project, I’d love to hear about it.

email: [email protected]
twitter: @seivanheidari

License

SHObjectUserInfo is © 2013 Seivan and may be freely
distributed under the MIT license.
See the LICENSE.md file.

Latest podspec

{
    "name": "SHObjectUserInfo",
    "version": "1.2.2",
    "summary": "NSObject prefixed userInfo without swizzling.",
    "description": "                    SHObjectUserInfo is a category on top of NSObject to allow userInfo dictionary without the swizzling. It's built on top of NSMapTable that works with weakToWeak references between an object and its userInfo.nnn                    * No need to clean up after - userInfo are self maintained.n                    * Weak referenced blocks.n                    * No swizzling or hacks.n                    * Name-scoped selectors.n                    * Works with existing codebase that uses userInfo dictionaries on them.nn",
    "homepage": "https://github.com/seivan/SHObjectUserInfo",
    "license": {
        "type": "MIT"
    },
    "authors": {
        "Seivan Heidari": "[email protected]"
    },
    "source": {
        "git": "https://github.com/seivan/SHObjectUserInfo.git",
        "tag": "1.2.2"
    },
    "platforms": {
        "ios": "6.0",
        "osx": "10.8"
    },
    "source_files": "SHObjectUserInfo/**/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This