Latest 0.1.1
Homepage https://github.com/panyult/LTRunLoop
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit, Foundation, CoreFoundation
Authors

CI Status
Version
License
Platform

Using LTRunLoop you can just deliver your pending data,which needs to be handled on a secondary thread by the the method you provide,then LTRunLoop help you create a secondary thread and run the run loop of the thread to dispatch your data via input source.Finally,the run loop will invoke your method to handle the data,as an argument passed in,which you had delivered.LTRunLoop let you focus on input and hanlers of data.

Quick Start

1.Start the manager.

    [[LTRunLoopManager manager] start];

2.Add a task to manager and declare who will handle the task’s data.

Using an object to handle the data


    id data = [NSString stringWithFormat:@"success test send a LTRunLoopTaskn%d",++self.count];

    LTSourceTask *task = [LTSourceTask getASourceTaskWithPeddingData:data
        sourceHandler:anObject]; 

    [[LTRunLoopManager manager] addSourceTask:task];

Or Using a class to handle the data
, but the class must confirm the protocol RunLoopSourceHandler.

    static int count = 0;

    id data = [NSString stringWithFormat:@"success test send a LTRunLoopTaskn%d",++count];

    LTSourceTask *task = [LTSourceTask sourceTaskWithPeddingData:data sourceHandlerClassName:NSStringFromClass(LTViewController.class)];

    [[LTRunLoopManager manager] addSourceTask:task];

3.handle the data dispatched by the run loop of a secondary

RunLoopSourceHandler.h declare two methods as follow:

- (void)object_runLoopSourceHandled:(LTSourceData *)sourceData;

+ (void)class_runLoopSourceHandled:(LTSourceData *)sourceData;

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

LTRunLoop is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'LTRunLoop'

Author

panyult, [email protected]

License

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

Latest podspec

{
    "name": "LTRunLoop",
    "version": "0.1.1",
    "summary": "LTRunLoop help you to define self-define input source when you want use the run loop of a secondary thread to handle something for you.",
    "homepage": "https://github.com/panyult/LTRunLoop",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "panyult": "[email protected]"
    },
    "source": {
        "git": "https://github.com/panyult/LTRunLoop.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "LTRunLoop/**/*.{h,m}",
    "frameworks": [
        "UIKit",
        "Foundation",
        "CoreFoundation"
    ]
}

Pin It on Pinterest

Share This