new approach to ask my question. I thought it was clear but apparently not. :-D 2nd chance.
I use SWXMLhash to get information from websites. For each website i need a different struct, because the datastructure of each website is different.
I have a good working function (using 1 website as source) which i would like to transform to a general function depending on the chosen website.
The best solution i have got so far (see code below) got me a compile error on:
TorrentProviderItem = try xmlTorrent["rss"]["channel"]["item"].value()
compile error = Ambiguous reference to member 'subscript'
code of function:
private func setResultsToEqualData(result: String, Torrentprovider: TorrentProviders) {
var TorrentProviderItem: [XMLIndexerDeserializable]
var xmlTorrent: XMLIndexer!
xmlTorrent = SWXMLHash.parse(result)
switch Torrentprovider {
case .ExtraTorrent:
TorrentProviderItem = [ExtraTorrentItem]()
default:
TorrentProviderItem = [Torrentz2Item]()
}
do {
TorrentProviderItem = try xmlTorrent["rss"]["channel"]["item"].value()
} catch {
print("FOUT in torrent!!")
return
}
selectBestResult()
}
I have no clue how to fix this. Anyone else?
ps in the original function for 1 website i use:
var TorrentProviderItem: [ExtraTorrentItem]
and without the switch, that works fine.