I have created DTOUser, DTOLocation struct model and defined User, Location protocol like below
struct DTOUser {
var name: String
var age: Int
var location: DTOLocation
}
struct DTOLocation {
var city: String
var country: String
}
protocol User {
var name: String { get }
var age: Int { get }
var location: Location { get }
}
protocol Location {
var city: String { get }
var country: String { get }
}
and extend DTOLocation and DTOUser but DTOUser can't extend User protocol because User did not defined Location type named location variable
extension DTOLocation: Location {}
extension DTOUser: User {} << ERROR HERE
// type 'DTOUser' does not conform to protocol 'User'
I want to extend DTOUser model extend User protocol how can i do it? any idea?