@dynamicMemberLookup struct Employee { subscript(dynamicMember member: String) -> String { let properties = ["name": "Taylor Swift", "city": "Nashville"] return properties[member, default: ""] } subscript(dynamicMember member: String) -> Int { let properties = ["age": 26, "height": 178] return properties[member, default: 0] } } let e = Employee() let name: String = e.name // "Taylor Swift" let city: String = e.city // "Nashville" let age: Int = e.age // 26 let height: Int = e.height // 178 let city_wrongType: Int = e.city // 0 let height_wrongType: String = e.height // ""