我试图将类范围限制在函数内.这似乎有效:
func foo() { class MyClass { var s = "" } }
我可以在foo()函数中创建MyClass的实例.
func foo() { class MyClass { @lazy var s = "" } }
…我收到以下构建错误:
- Global is external,but doesn’t have external or weak linkage!
- invalid linkage type for function declaration
- LLVM ERROR: Broken module found,compilation aborted!
class MyClass { @lazy var s = "" }