I want to print instance address.
But I use protocol to create Person.
And I get error like Generic struct 'Unmanaged' requires that 'Person' be a class type
Have any idea to print parent instance address?
protocol Person {
var name: String { get }
}
class Parent: Person {
let name: String
init(name: String) {
self.name = name
}
}
let parent = Parent(name: "Jeff")
print(Unmanaged.passUnretained(parent).toOpaque()) //Generic struct 'Unmanaged' requires that 'Person' be a class type