1

Let me share the code.

public class A {
    public class B { }
}

Now when i want to make a array of type B. I would natuarally use this syntax.

let intarr = [Int]()
let c = [A.B]()         //cannot call value of non-function type A.B.Type

However, swift wont allow me to use array the above way. But, the following 2 ways doesnot error.

let c1 = Array<A.B>()
let c2: [A.B] = []

The question now is: why is the first expression let c = [A.B]() not valid?

kandelvijaya
  • 1,545
  • 12
  • 20

0 Answers0