Avatar
@swift-4.2.4 import Foundation class Entity<Id: Hashable, Props> { let id: Id let data: Props init(id: Id, data: Props) { self.id = id self.data = data } } class User: Entity<User.Id, User.Props> { struct Id: Hashable { } struct Props { var name: String } } let user = User(id: .init(), data: .init(name: "user_name")) print(user, user.data.name)