You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.2 KiB
57 lines
1.2 KiB
//
|
|
// ExportFormat.swift
|
|
// PadelClub
|
|
//
|
|
// Created by Razmig Sarkissian on 19/07/2024.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public enum ExportFormat: Int, Identifiable, CaseIterable {
|
|
public var id: Int { self.rawValue }
|
|
|
|
case rawText
|
|
case csv
|
|
|
|
public var suffix: String {
|
|
switch self {
|
|
case .rawText:
|
|
return "txt"
|
|
case .csv:
|
|
return "csv"
|
|
}
|
|
}
|
|
|
|
func separator() -> String {
|
|
switch self {
|
|
case .rawText:
|
|
return " "
|
|
case .csv:
|
|
return ";"
|
|
}
|
|
}
|
|
|
|
public func newLineSeparator(_ count: Int = 1) -> String {
|
|
return Array(repeating: "\n", count: count).joined()
|
|
}
|
|
}
|
|
|
|
public enum ExportType: Int, Identifiable, CaseIterable {
|
|
public var id: Int { self.rawValue }
|
|
|
|
case sharing
|
|
case payment
|
|
|
|
public func localizedString() -> String {
|
|
switch self {
|
|
case .sharing:
|
|
return "inscriptions"
|
|
case .payment:
|
|
return "pointage"
|
|
}
|
|
}
|
|
|
|
public func newLineSeparator(_ count: Int = 1) -> String {
|
|
return Array(repeating: "\n", count: count).joined()
|
|
}
|
|
}
|
|
|