Migrate Swift struct to Swift class to allow generateMenu to be called by objc selector

This commit is contained in:
Felix Förtsch
2019-01-01 17:48:28 +01:00
parent 62505e56bb
commit c41cdb0f80
3 changed files with 29 additions and 20 deletions
+9 -9
View File
@@ -44,15 +44,15 @@ class MatchesAPI {
let leftscore = String(split[0])
let rightscore = String(split[1])
let newMatch = Match(
ongoing: true,
streamLink: "https://twitch.tv" + (match.getAttributes()?.get(key: "data-stream-twitch"))! ,
league: try match.select("tr > td > div > div > a").text(),
team1name: try match.getElementsByClass("team-left").text(),
team1score: leftscore,
team2name: try match.getElementsByClass("team-right").text(),
team2score: rightscore
)
let newMatch = Match()
newMatch.ongoing = true
newMatch.streamLink = "https://twitch.tv" + (match.getAttributes()?.get(key: "data-stream-twitch"))!
newMatch.league = try match.select("tr > td > div > div > a").text()
newMatch.team1name = try match.getElementsByClass("team-left").text()
newMatch.team1score = leftscore
newMatch.team2name = try match.getElementsByClass("team-right").text()
newMatch.team2score = rightscore
print(newMatch)
matches.append(newMatch)
}
return matches