Avatar
omochimetaru 3/15/2019 4:09 AM
class Animal {} class Cat : Animal {} class User { var cat: Cat init(cat: Cat) { self.cat = cat } static let keyPaths: [KeyPath<User, Animal>] = [ // Key path value type 'Cat' cannot be converted to contextual type 'Animal' \User.cat ] }
4:10 AM
KeyPath型はReadonlyなのでcovarianceとして正しそうだけど、これはできないのか。