Currently, I'm having issues when I updated my PromiseKit from Swift 2 to Swift 4. A lot of my Promises are returning this issue from NSDictionary to Guarantee Void. I don't understand why this issue arises. If someone could explain it to me, that'd be much appreciated!
func getPlayerGameLog(sportName: String) -> Promise<NSArray> {
let team = (self as? PlayerWithPositionAndGame)?.team
let position = (self as? PlayerWithPositionAndGame)?.position
if sportName == "mlb" {
return when(Data.mlbPlayerGameLogs[id].get(), Data.sportsTeams[sportName].get()).then { (result, teams) -> NSArray in
if result.count == 0 {
return []
} else {
// Omitted Code
return gameStats
}
}
} else if sportName == "nfl" {
return when(Data.nflPlayerGameLogs[id].get(), Data.sportsTeams[sportName].get()).then { (result, teams) -> NSArray in
if result.count == 0 {
return []
} else {
// Omitted Code
return gameStats
}
}
} else {
return Data.nbaPlayerGameLogs[id].get().then { gameLogs in
return []
}
}
}
Now the declaration of game logs is as follows
static let mlbPlayerGameLogs = MultiCache { id in API.getMLBPlayerGameLogs(playerID: id) }
It's the same for mlb/nfl/nba.
The purpose of the function is pretty simple. It's just pulling in the team info into the function and returning it.
Errors occur on the "return when()" Lines