我似乎有實例使用[foo]()
風格的語法嵌套類類型的空數組問題:爲什麼我不能實例化一個嵌套類的空數組?
// 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]()
這事我誤解,這是我的咖啡前,但我檢查了釋放筆記,我認爲你應該能夠引用像這樣的嵌套類 - 或測試版7中的錯誤?
這工作得很好的解決方法:
var foobar: [Wrapper.InsideClass] = []
還有其他''type]()'語法不起作用的情況,例如,與元組。向Apple發送錯誤報告。 – 2014-09-05 09:13:37
@MartinR謝謝。您的評論和一杯咖啡適合您的信心,我會這樣做,並回答這個問題。 – 2014-09-05 10:05:07