获取实例类型:
let testString = "test"
print(type(of: testString))
let testInt: Int = 7
print(type(of: testInt))
let testArray = [Any]()
print(type(of: testArray))
或者
let value = paramsDict[key]!
let paramType = String(describing:type(of: value)).self)
输出结果如下:
图片.png
网友评论