hiddevdploeg/Billboard

Fetching one or more adverts currently not possible as described in the documentation

Closed this issue · 3 comments

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 parameter
  • fetchRandomAd 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?

Task {
    try await BillboardViewModel.fetchRandomAd(from: adsURL)
}

Should now work :) thanks for letting me know

okay, if this is the way it should work and documentation will be updated, this issue can be closed I think :)

I'm sorry I mean it works without the URL now :)