As you noted, it works with this syntax:
let arrayOfClassB: [ClassA.ClassB] = []
but the []()
syntax works if we declare a typealias
:
typealias InnerClass = ClassA.ClassB
let arrayOfAliasesOfClassB = [InnerClass]()
So I'd say it's a bug, let arrayOfClassB = [ClassA.ClassB]()
should also work without needing a typealias.
Update: there's already an opened bug about this at Apple.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…