Hi I am making an application that scrapes data from 2 different web, when I call the functions in the .OnAppear method 1 of the two does not work.
But if I call it from the .Refreshable, that is to say making swipeDown, the call to the web works, to what is this due ?
my two functions
-fetchDolar()
-fetchHistorico()
func fetchDolar() {
print("Scrapeando datos blue")
Scrapper.shared.scrappearDolar() {result in
DispatchQueue.main.async {
self.isLoading = false
switch result {
case .success(let data):
self.dolar = data
case .failure(let error):
self.error = error
print("Error(error)")
}
}
}
}
func fetchHistorico() {
// print("scrapeando Historico")
Scrapper.shared.scrapearHistoricoDolar() {result in
DispatchQueue.main.async {
self.isLoadingHistorico = false
switch result {
case .success(let data):
print("Entro en el historico")
self.historicoDolar = data
case .failure(let error):
self.error = error
print("Error(error)")
}
}
}
}
New contributor
Gaston Foncea is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.