struct Person {
let name: String
let age: Int
}
let xiaoMing = Person(name: "XiaoMing", age: 16)
let r = Mirror(reflecting: xiaoMing)
print("xiaoMing 是 \(r.displayStyle!)")
//输出- xiaoMing 是 struct
// displayStyle是一个枚举里面包含了 一些类型
public enum DisplayStyle {
case `struct`
case `class`
case `enum`
case tuple
case optional
case collection
case dictionary
case set
}
网友评论