CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Aug 2015 |
SPMSupports SPM | ✗ |
Maintained by Shinichiro Aska.
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.
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)
}
}
}
}
DelimitedReader is released under the MIT license. See LICENSE for details.