I have the following structure and would like to import the data from a txt file but from a web page instead of the app, is there any way to do it?
I want to access the data through a web address.
if let filePath = Bundle.main.path(forResource: "archivotxt", ofType: "txt") {
do {
let contenido = try String(contentsOfFile: filePath)
let fila = contenido.components(separatedBy: "\n")
for i in 1..<fila.count {
let datosArchivo = fila[i].components(separatedBy: "\t")
//print(datosArchivo[1])
let campos = Lista(nom: datosArchivo[0], dir: datosArchivo[1], tel: datosArchivo[2])
self.lista.append(campos)
}
} catch let error as NSError {
print("error al leer el archivo", error)
}
}else{
print("no existe el archivo")
}