【发布时间】:2016-01-15 15:04:04
【问题描述】:
Swift 中的静态变量是如何存储的?
如果我从不调用函数 useStaticVar() 会发生什么?这些变量是否已初始化?
-
如果我调用 useStaticVar() 然后再也不访问它们会怎样?阿尔
struct Something { static var myVariable = 0 static let myConstant = 3 static var myString: String? static func useStaticVar() { myVariable = myConstant myString = String(myVariable) } }
【问题讨论】:
标签: swift