CFString.self是什么意思?
What is the meaning of CFString.self?
我看过 Q/A here about the self
keyword in Swift.
但是,对我来说,这并不能解释 this question
中以下代码片段中 .self
的使用
let attributes: [String: Any] =
[kSecAttrKeyType as String:CFString.self,
kSecAttrKeySizeInBits as String:numberOfBits]
在这种情况下 self
做什么?
Type.self
是作为值的类型。
有区别
let s : String = "hello world"
其中字符串声明 s
的类型,
let sometype : Any = String.self
我们将 String 类型本身指定为要存储的 value。这就是所谓的 元类型.
我看过 Q/A here about the self
keyword in Swift.
但是,对我来说,这并不能解释 this question
中以下代码片段中.self
的使用
let attributes: [String: Any] =
[kSecAttrKeyType as String:CFString.self,
kSecAttrKeySizeInBits as String:numberOfBits]
在这种情况下 self
做什么?
Type.self
是作为值的类型。
有区别
let s : String = "hello world"
其中字符串声明 s
的类型,
let sometype : Any = String.self
我们将 String 类型本身指定为要存储的 value。这就是所谓的 元类型.