Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created May 2, 2022 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitomad/697c8b636851652944f375ceee7bfa74 to your computer and use it in GitHub Desktop.
Save fitomad/697c8b636851652944f375ceee7bfa74 to your computer and use it in GitHub Desktop.
// Leemos el archivo de Peatones 2019
var csvReadOptions2019 = CSVReadingOptions(hasHeaderRow: true, delimiter: ";")
// Tratamiento para las fechas
// El formato es 16/08/2022
csvReadOptions2019.addDateParseStrategy(
Date.ParseStrategy(format: "\(day: .twoDigits)/\(month: .twoDigits)/\(year: .defaultDigits)",
locale: Locale(identifier: "es_ES"),
timeZone: TimeZone.current)
)
let columnTypes2019 = [
"FECHA" : CSVType.date,
"HORA" : CSVType.string,
"PEATONES" : CSVType.string,
"DISTRITO" : CSVType.string,
"NOMBRE_VIAL" : CSVType.string,
"NÚMERO" : CSVType.integer,
"CÓDIGO_POSTAL" : CSVType.string,
"LATITUD" : CSVType.string,
"LONGITUD" : CSVType.string
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment