Skip to content

Commit 4620b0e

Browse files
committed
Fixed the delimiter issue.
Note: #7
1 parent f992886 commit 4620b0e

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

SwiftCSVExport.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "SwiftCSVExport"
19-
s.version = "1.0.7"
19+
s.version = "1.0.8"
2020
s.summary = "Simple way to export csv file with rich feature framework and written in Swift 3 & 4."
2121

2222
# This description is used to generate tags and improve search results.

SwiftCSVExport/Sources/CSVExport.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ extension String {
133133
open var encodingType:String.Encoding = String.Encoding.utf8;
134134

135135
/// The CSV cell separator
136-
open var divider: DividerType?
136+
open var divider: String?
137137

138138
/// The CSV File Manager
139139
let fileManager = FileManager.default
@@ -151,7 +151,7 @@ extension String {
151151

152152
/// Get Divider character
153153
func getDividerCharacter( ) -> String {
154-
return divider?.rawValue ?? ",";
154+
return divider ?? ",";
155155
}
156156

157157
/// A free function to convert from NSMutableDictionary to CSV object
@@ -432,7 +432,7 @@ extension String {
432432

433433
/// A free function to make export the CSV file from file name, fields and values
434434
public func exportCSV(_ csvObj:CSV) -> String {
435-
CSVExport.export.divider = DividerType.comma
435+
CSVExport.export.divider = csvObj.delimiter
436436
return CSVExport.export.exportCSV(csvObj.name, fields: csvObj.fields, values: csvObj.rows);
437437
}
438438

SwiftCSVExportTests/SwiftCSVExportTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class SwiftCSVExportTests: XCTestCase {
5656
writeCSVObj.name = "userlist"
5757

5858
// Write File using CSV class object
59+
writeCSVObj.delimiter = DividerType.semicolon.rawValue
5960
let filePath:String = SwiftCSVExport.exportCSV(writeCSVObj);
6061
print(filePath)
6162

0 commit comments

Comments
 (0)