Skip to content

Latest commit

 

History

History
31 lines (19 loc) · 785 Bytes

README.md

File metadata and controls

31 lines (19 loc) · 785 Bytes

OCGeneric

Basis Generic Support in Objective-C.

  • Including OCGenerics.h

  • Register the class you want to use in NSArray

    GENERIC(NSString)
    GENERIC(NSNumber)
  • Declaring a faked NSMuatbleArray like this
    NSMutableArray(NSString) *strAry = [[NSMutableArray(NSString) alloc] init];
    NSMutableArray(NSNumber) *numberAry = [[NSMutableArray(NSNumber) alloc] init];
  • Type Recognize

    The Xcode will figure out the wrong type when you want to add a NSNumber object into an NSString Array

2014-04-16 4 52 40

  • Extensions

    You can make some extentions based on this by adding more functions into OCGenerics.h