Latest 0.1.3
Homepage https://github.com/IvanRublev/VRFoundationToolkit
License MIT
Platforms ios 6.0, osx 10.8, requires ARC
Dependencies libextobjc, MAObjCRuntime
Frameworks Foundation
Authors

CI Status
Version
License

This library extends NSFoundation with categories, macros & classes. Effective Obj-C developer’s mini-toolkit) It can be used in iOS or OS X projects for faster coding.

What’s inside

Categories

  • NSArray+VRArgument – sequentially passes each element of array to provided selector of target object or class.
  • NSArray+VRCheckMembers – checks if all members of array are of specified class.
  • NSArray+VRIndexes – returns indexes set of passed objects.
  • NSBundle+VRDisplayName – obtains localized display name of bundle with fallback to non-nil string precompiler constant if name is not accessible.
  • NSDate+VRDurations – calculates how much days, hours, minutes between two dates. Returns end of day. Compare two dates by specified NSCalendarUnit units. Return NSDateComponents for specified NSCalendarUnit units. Returns default NSCalendar.
  • NSFileManager+VRDocumentsDirectory – quick access for Documents directory and Temporary directory paths. Random file names generation. etc.
  • NSMutableDictionary+VRExchangeKeys – exchanges keys in dictionary.
  • NSObject+VRPropertiesProcessing – process object properties with blocks. Hash, equality & encode/decode by properties for any object.
  • NSObject+VRProtocolConformation – checks if object/class responds to all selectors required by protocol. Useful as precondition check of object in delegate setter.
  • RTProtocol+VRMethods – returns methods defined in protocol.
  • NSString+VRmd5 – MD5 hash on string.
  • NSTimer+VRWithBlock – timer that executes block instead of selector.
  • NSOperationQueue+VRNamedBlock – add named block operation to queue.

Macros

  • VREnumXXX – generates enums with utility functions. NSStringFromXXX returns enum constant by value. isValidXXX checks range of enum value.
  • VRLOGxxx – multilevel logging & assertion macros. Could be connected to preferable logging system. VRPRECONDITIONxxx macros to implement light design by contract.
  • VRKeyName – stringifyes expression to key for -[NSCoder encodeObject:withKey:]. Useful to make names via help of XCode autocompletion.
  • VRSingleton – return singleton.
  • VROBJCTYPExxx – returns Objective-C type string representation of the passed variable (or type). VRIS_TYPE_EQUAL_TO_TYPE(V1, V2) compares Objective-C types of two passed values/types.
  • VRBundledName – returns NSString with reverse dns bundle name followed by passed NAME at the end of the string.
  • VRRandom – returns random float value calculated via result from random().

Classes

  • VRURLConnectionChecker – checks if default site or specified URL is accessible with completion and error blocks.

Functions

  • NSComparisonInvertedResult – inverts the comparison result.
  • VRCanPerform – checks if object conforms to protocol & responds to selector. Usefull for precondition check in delegate setters.

Requirements

iOS SDK 6.0+ and OSX SDK 10.8+ are required respectively.

libextobjc is required for metamacros in VRLog.h and VREnum.h.
MAObjCRuntime is required for VRProtocolConformation category of NSObject.

Installation

Using CocoaPods

VRFoundationToolkit is available through CocoaPods. Simply add the following line to your Podfile:

pod "VRFoundationToolkit"

and run pods update or pods install.

Manually

  • Make Workspace for your project, if you havent do so, via Xcode menu File -> New -> Workspace. Make sure that your .xcworkspace file is on the same level as .xcodeproj of your project and that the last one is added to the Workspace.
  • Open the Workspace within Xcode.
  • Subtree this repository, for example to Requirements subdirectory in your project.

    git subtree add --prefix=Requirements/VRFoundationToolkit --squash https://github.com/IvanRublev/VRFoundationToolkit.git master
  • Subtree dependencies there as also.
git subtree add --prefix=Requirements/libextobjc --squash https://github.com/jspahrsummers/libextobjc.git master

git subtree add --prefix=Requirements/MAObjCRuntime --squash https://github.com/mikeash/MAObjCRuntime.git master
  • Drag & drop VRFoundationToolkit.xcodeproj, extobjc.xcodeproj & MAObjCRuntime.xcodeproj in to your workspace.
  • Make sure that settings of libextobjc (iOS) and MAObjCRuntime_iOS targets of extobjc and MAObjCRuntime.xcodeproj projects respectively, are following: Architectures is set to Standard architectures and Base SDK is set to Lastest iOS.
  • Add -ObjC to Other Linker Flags in your project’s Build Settings. And add ./Requirements/** to Header Search Paths.
  • Add libVRFoundationToolkit.a, libextobjc_iOS.a & libMAObjCRuntime_iOS.a (or VRFoundationToolkitOSX, libextobjc_OSX.a & libMAObjCRuntime.a for OS X) in "Link Binary With Libraries" section of "Build phases" tab of your project’s target.
  • Add #import <VRFoundationToolkit/VRFoundationToolkit.h> to YourProject-Prefix.pch or where you want to use it.

Now it’s ready to use, build & run!

Author

Ivan Rublev, [email protected]

License

VRFoundationToolkit is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "VRFoundationToolkit",
    "version": "0.1.3",
    "summary": "Extends NSFoundation with categories, macros & classes. Effective Obj-C developer's mini-toolkit)",
    "description": "Extends NSFoundation with categories, macros & classes.nn## Categoriesn* __NSArray+VRArgument__ - sequentially passes each element of array to provided selector of target object or class.n* __NSArray+VRCheckMembers__ - checks if all members of array are of specified class.n* __NSArray+VRIndexes__ - returns indexes set of passed objects. n* __NSBundle+VRDisplayName__ - obtains localized display name of bundle with fallback to non-nil string precompiler constant if name is not accessible.n* __NSDate+VRDurations__ - calculates how much days, hours, minutes between two dates. Returns end of day. Compare two dates by specified NSCalendarUnit units. Return NSDateComponents for specified NSCalendarUnit units. Returns default NSCalendar.n* __NSFileManager+VRDocumentsDirectory__ - quick access for Documents directory and Temporary directory paths. Random file names generation. etc.n* __NSMutableDictionary+VRExchangeKeys__ - exchanges keys in dictionary.n* __NSObject+VRPropertiesProcessing__ - process object properties with blocks. Hash, equality & encode/decode by properties for any object.n* __NSObject+VRProtocolConformation__ - checks if object/class responds to all selectors required by protocol. Useful as precondition check of object in delegate setter.n* __RTProtocol+VRMethods__ - returns methods defined in protocol.n* __NSString+VRmd5__ - MD5 hash on string.n* __NSTimer+VRWithBlock__ - timer that executes block instead of selector.n* __NSOperationQueue+VRNamedBlock__ - add named block operation to queue.nn## Macrosn* __VREnumXXX__ - generates enums with utility functions. NSStringFromXXX returns enum constant by value. isValidXXX checks range of enum value.n* __VRLOGxxx__ - multilevel logging & assertion macros. Could be connected to preferable logging system. VRPRECONDITIONxxx macros to implement light design by contract.n* __VRKeyName__ - stringifyes expression to key for `-[NSCoder encodeObject:withKey:]`. Useful to make names via help of XCode autocompletion.n* __VRSingleton__ - return singleton.n* __VROBJCTYPExxx__ - returns Objective-C type string representation of the passed variable (or type). VRIS_TYPE_EQUAL_TO_TYPE(V1, V2) compares Objective-C types of two passed values/types.n* __VRBundledName__ - returns NSString with reverse dns bundle name followed by passed NAME at the end of the string.n* __VRRandom__ - returns random float value calculated via result from random().n                       n## Classesn* __VRURLConnectionChecker__ - checks if default site or specified URL is accessible with completion and error blocks.nn## Functionsn* __NSComparisonInvertedResult__ - inverts the comparison result.n* __VRCanPerform__ - checks if object conforms to protocol & responds to selector. Usefull for precondition check in delegate setters.",
    "homepage": "https://github.com/IvanRublev/VRFoundationToolkit",
    "license": "MIT",
    "authors": {
        "Ivan Rublev": "[email protected]"
    },
    "source": {
        "git": "https://github.com/IvanRublev/VRFoundationToolkit.git",
        "tag": "0.1.3"
    },
    "requires_arc": true,
    "platforms": {
        "ios": "6.0",
        "osx": "10.8"
    },
    "source_files": "VRFoundationToolkit",
    "frameworks": "Foundation",
    "dependencies": {
        "libextobjc": [
            "~> 0.4"
        ],
        "MAObjCRuntime": []
    },
    "subspecs": [
        {
            "name": "RTProtocol+VRMethods",
            "source_files": "VRFoundationToolkit/RTProtocol+VRMethods/*.{h,m}"
        },
        {
            "name": "LogAndPreconditionCheck",
            "source_files": "VRFoundationToolkit/LogAndPreconditionCheck/*.{h,m}",
            "dependencies": {
                "VRFoundationToolkit/RTProtocol+VRMethods": []
            }
        },
        {
            "name": "PropertiesProcessing",
            "source_files": "VRFoundationToolkit/NSObject+VRPropertiesProcessing/*.{h,m}",
            "dependencies": {
                "VRFoundationToolkit/LogAndPreconditionCheck": []
            }
        },
        {
            "name": "ConnectionChecker",
            "source_files": "VRFoundationToolkit/VRURLConnectionChecker/*.{h,m}",
            "dependencies": {
                "VRFoundationToolkit/LogAndPreconditionCheck": []
            }
        },
        {
            "name": "NSArray+VRArgument",
            "source_files": "VRFoundationToolkit/NSArray+VRArgument/*.{h,m}",
            "dependencies": {
                "VRFoundationToolkit/LogAndPreconditionCheck": []
            }
        }
    ]
}

Pin It on Pinterest

Share This