So I have this child class with a function that creates a perdetermined array of other classes.
class DirectGame : GameParent {
static func GetAllChallenges() -> Array<ChallengeParent>{
return [LockdownChallenge(game: self)]
}
}
These other classes take in a GameParent class in the initalizer like so:
class LockdownChallenge {
var game : GameParent
init(game: GameParent) {
self.game = game
}
}
However this line
return [LockdownChallenge(game: self)]
is throwing the error "Cannot convert value of type 'DirectGame.Type' to expected argument type 'GameParent'"
How do I pass in a reference to DirectGame into the initalizer of ChallengeParent?