Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Headers to provide subscripting support. The implementations are provided by libarclite.
Objective-C
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore Initial commit
Foundation+sdfsubscripts.h Revert "arclite adds support for subscripting to NSCache, too."
NSCache+sdfextrasubs.h Add swizzle for NSCache.
NSCache+sdfextrasubs.m Future compatibility.
NSUserDefaults+sdfextrasubs.h
NSUserDefaults+sdfextrasubs.m Update NSUserDefaults+sdfextrasubs.m
README.md Add a demonstration of swizzling to install subscripting support to N…

README.md

iOS-Subscripting

Headers to provide subscripting support. The implementations are provided by libarclite.

This is an interim solution to subscripting; it will almost certainly not be necessary when the iOS 6 SDK is released (even for building to iOS 5).

Contents

  • Foundation+sdfsubscripts.h: The header file that adds subscripting support to NSArray, NSMutableArray, NSDictionary and NSMutableDictionary.
  • NSUserDefaults+sdfextrasubs.h and NSUserDefaults+sdfextrasubs.m: A demonstration of how to patch an existing class to support subscripts.

Usage

  1. Add Foundation+sdfsubscripts.h to your project.
  2. #import "Foundation+sdfsubscripts.h" Ideally, from your prefix.
  3. Examine the technique used in NSUserDefaults+sdfextrasubs.h and NSUserDefaults+sdfextrasubs.m. You probably don't want to use this file directly, however.

License

For this? Free and public domain. Do whatever you want with it. Enjoy.

Future

  • Add support for any other classes swizzled by libarclite to Foundation+sdfsubscripts.h. I don't have a list, so there may be others.
  • Add a more useful swizzling category.

See also

Something went wrong with that request. Please try again.