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.
- 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.
- 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().
- VRURLConnectionChecker - checks if default site or specified URL is accessible with completion and error blocks.
- NSComparisonInvertedResult - inverts the comparison result.
- VRCanPerform - checks if object conforms to protocol & responds to selector. Usefull for precondition check in delegate setters.
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.
VRFoundationToolkit is available through CocoaPods. Simply add the following line to your Podfile:
pod "VRFoundationToolkit"
and run pods update
or pods install
.
- 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)
andMAObjCRuntime_iOS
targets ofextobjc
andMAObjCRuntime.xcodeproj
projects respectively, are following: Architectures is set toStandard architectures
and Base SDK is set toLastest 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
(orVRFoundationToolkitOSX
,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!
Ivan Rublev, ivan@ivanrublev.me
VRFoundationToolkit is available under the MIT license. See the LICENSE file for more info.