 //  Copyright (c) 2014 Frank Vernon. All rights reserved.
 //
 
-import UIKit
+import Foundation
 
 fileprivate let fieldDelimiter:Character = ","
 fileprivate let recordDelimiter:Character = "\r\n"

    
    fileprivate func encode(record: [String]) -> String {
        let escapedRecord:[String] = record.map { (field) -> String in
            guard field.contains(quoteCharacter) else {
                return field
            }
            
            let escapedField = field.replacingOccurrences(of: quoteSequence, with: escapeSequence, options: NSString.CompareOptions.literal, range: nil)
            return quoteSequence + escapedField + quoteSequence
        }
        return escapedRecord.joined(separator: fieldDelimiterSequence)
    }
}


            // supporting bare CR & LF, not required by RFC4180 but common
			else if !quoted && (current == bareReturn || current == bareLinefeed) {
				testRecordEnd = true
                return
			}
                
            //if outside of quoted section and at end of record then: add last field to record,
