CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.

DelimitedReader 0.0.3

DelimitedReader 0.0.3

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Aug 2015
SPMSupports SPM

Maintained by Shinichiro Aska.



  • By
  • aska

DelimitedReader Build Status

Library for parsing delimited data.

It can be easily and reliably parse of the Twitter Streaming API and other stream.

Faster because it does not have to do a NSData <-> String conversion.

Performance Test

Requirements

  • iOS 8.0+ / Mac OS X 10.10+
  • Xcode 7

Installation

Usage

for Twitter Streaming API

See Processing streaming data for information about the Parsing responses you will receive from the streaming API.

import Foundation
import DelimitedReader
import SwiftyJSON

class TwitterAPIStreamingRequest: NSObject, NSURLSessionDataDelegate {

    let delimitedReader = DelimitedReader(delimiter: "\r\n".dataUsingEncoding(NSUTF8StringEncoding)!)

    // ...

    func connection(connection: NSURLConnection, didReceiveData data: NSData) {
        self.delimitedReader.appendData(data)
        while let data = self.delimitedReader.readData() {
            if data.length > 0 {
                let json = JSON(data: data)
            }
        }
    }
}

License

DelimitedReader is released under the MIT license. See LICENSE for details.