davedelong/CHCSVParser

Swift delegate prototypes (a comment, not an issue)

dhoerl opened this issue · 2 comments

This class is working fine for me in a Swift project. The read delegate functions:

func parserDidBeginDocument(parser: CHCSVParser) {
}
func parser(parser: CHCSVParser, didFailWithError error: NSError) {
}
func parserDidEndDocument(parser: CHCSVParser) {
}
func parser(parser: CHCSVParser, didBeginLine recordNumber: UInt) {
}
func parser(parser: CHCSVParser, didEndLine recordNumber: UInt) {
}
func parser(parser: CHCSVParser, didReadField field: NSString?, atIndex fieldIndex: UInt) {
}
func parser(parser: CHCSVParser, didReadComment field: NSString?) {
}

I'm glad that it's working in Swift! The Swifitification of CHCSVParser is on my "eventually" list. :)

I am trying to use your delegate functions, but run into trouble with parser:didReadField:asIndex
If I use it as it is written here I get an error from xcode:

/Users/andya/Work/Outsource/Bible/app/Bible Quotes/Bible Quotes/Model/QuoteDatabase.swift:48:10: Objective-C method 'parser:didReadField:atIndex:' provided by method 'parser(:didReadField:atIndex:)' conflicts with optional requirement method 'parser(:didReadField:atIndex:)' in protocol 'CHCSVParserDelegate'

I am uncertain how fix this. Changing "UInt" to "UInt" clearing the xcode error, but the delegate is not called. The signature is wrong.

aa