如果我们用所有可选值声明结构,那么 swift 中结构的大小是多少?
If we declare structure with all optional values, what is the size of the structure in swift?
例如,我创建了一个包含所有可选值的结构。那么swift中的结构体大小是多少?我们如何计算swift中结构的大小?
您可以使用此代码。
struct Structure {
//Some properties here
}
let size = MemoryLayout<Structure>.size
例如,我创建了一个包含所有可选值的结构。那么swift中的结构体大小是多少?我们如何计算swift中结构的大小?
您可以使用此代码。
struct Structure {
//Some properties here
}
let size = MemoryLayout<Structure>.size