Fetching one or more adverts currently not possible as described in the documentation
Closed this issue · 3 comments
dhaydl commented
based on the current documentation, it should be possible to fetch an ad via BillboardViewModel
like this:
let newAdvert = try? await viewModel.fetchRandomAd()
advertisement = newAdvert
but there are two difference to what is actually implemented in code:
fetchRandomAd
needs an URL parameterfetchRandomAd
is static
current workaround:
guard let adsURL = BillboardConfiguration().adsJSONURL else {
return
}
Task {
try await BillboardViewModel.fetchRandomAd(from: adsURL)
}
a good solution would be to merge showAdvertisement
and fetchRandomAd
somehow. what would you say to this?
hiddevdploeg commented
Task {
try await BillboardViewModel.fetchRandomAd(from: adsURL)
}
Should now work :) thanks for letting me know
dhaydl commented
okay, if this is the way it should work and documentation will be updated, this issue can be closed I think :)
hiddevdploeg commented
I'm sorry I mean it works without the URL now :)