Latest 1.1.2
Homepage https://github.com/Rogaven/ODStringify
License MIT
Platforms ios 5.0, osx 10.6, watchos 1.0, tvos 9.0, requires ARC
Frameworks Foundation
Authors

Build Status
codecov.io
CocoaPods Compatible
Carthage compatible
Platform
Twitter

Usage

With ODStringify you can make strings from classes, properties, defines and functions
using one function. Safely.
And all things will be done compile time.
No more runtime overhead and calls like NSStringFromClass
(despite of for this function it was very small).

First of all you can make strings from defined value. It’s crazy. For example:

#define MAX_NUMBER_OF_SOMETHING 10
#define DEFAULT_HI_STRING @"hello"

NSLog(@"Hi string:%@", ODStringify(DEFAULT_HI_STRING)); // > @"hello" (@"@"hello"")
NSLog(@"Max number:%@", ODStringify(MAX_NUMBER_OF_SOMETHING)); // > 10 (@"10")

ODStringify

ODStringifyClass

Class’s name string with compile time type check.

NSLog(@"Valid class:%@", ODStringifyClass(AppDelegate)); // AppDelegate
NSLog(@"Invalid class:%@", ODStringifyClass(App_Delegate)); // Error

ODStringify

ODStringifyProperty

Pretty same thing for properties.
NB. You need to be inside of class implementation (and have self)

// AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    NSLog(@"Valid property:%@", ODStringifyProperty(window)); // window
    NSLog(@"Invalid property:%@", ODStringifyProperty(window_)); // Error
    return YES;
}

ODConcat

Allows us to concat any things. For example how it works in ODWeakify pod –
we concat name of variable with weak suffix to get new another one.

#define od_weakify(obj)  __weak __typeof(obj) ODConcat(obj, _weak_)

ODCurrentFileAndLine

Just current file and line as NSString

ODCompilerIgnorePush & ODCompilerPop

Two defines for simplifying compiler pragma pushes. Actually, maybe, will be better to move it in another pod :-)

ODCompilerIgnorePush(-Wgnu).
// some code
ODCompilerIgnorePop.

Installation

ODStringify supports multiple methods for installing the library in a project.

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C and Swift, which automates and simplifies the process of using 3rd-party libraries like ODStringify in your projects. You can install it with the following command:

$ gem install cocoapods

Podfile

To integrate ODStringify into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target 'TargetName' do
pod 'ODStringify'
end

Then, run the following command:

$ pod install

Installation with Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate ODStringify into your Xcode project using Carthage, specify it in your Cartfile:

github "Rogaven/ODStringify" ~> 1.1

Run carthage to build the framework and drag the built ODStringify.framework into your Xcode project.

Author

Alexey Nazaroff, [email protected]

License

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

Latest podspec

{
    "name": "ODStringify",
    "version": "1.1.2",
    "summary": "Make string from functions, classes, properties and defines safely",
    "homepage": "https://github.com/Rogaven/ODStringify",
    "license": {
        "type": "MIT",
        "file": "LICENSE.txt"
    },
    "authors": {
        "Alexey Nazaroff": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Rogaven/ODStringify.git",
        "tag": "1.1.2"
    },
    "social_media_url": "https://twitter.com/nazarff",
    "platforms": {
        "ios": "5.0",
        "osx": "10.6",
        "watchos": "1.0",
        "tvos": "9.0"
    },
    "prefix_header_contents": "#ifndef TARGET_OS_IOSn  #define TARGET_OS_IOS TARGET_OS_IPHONEn#endifn#ifndef TARGET_OS_WATCHn  #define TARGET_OS_WATCH 0n#endifn#ifndef TARGET_OS_TVn  #define TARGET_OS_TV 0n#endif",
    "requires_arc": true,
    "frameworks": "Foundation",
    "source_files": "src/**/*",
    "public_header_files": "src/include/**/*"
}

Pin It on Pinterest

Share This