I seem to be having problems instantiating an empty array of a nested class type using the [foo]()
style syntax:
// Playground - noun: a place where people can play
class outsideClass {
}
class Wrapper {
class InsideClass {
}
}
var foo = [outsideClass]() // Works fine
// Invalid use of '()' to call a value of non-function type '[Wrapper.InsideClass.Type]'
var bar = [Wrapper.InsideClass]()
Is this something I'm misunderstanding—it's before my coffee, but I've checked the release notes, and I think you should be able to refer to nested classes like this—or a bug in beta 7?
This works fine as a workaround:
var foobar: [Wrapper.InsideClass] = []
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…