数组初始化程序简写与Swift中的可选值

Nei*_*eil 4 arrays optional swift

我试图使用repeatedValues初始化程序初始化包含可选值的数组,我惊讶地发现以下代码无法编译

let a: Int?[] = Int?[](count: 10, repeatedValue:nil)
// error - Value of Int?[]? not unwrapped; did you mean to use '!' or '?'?
Run Code Online (Sandbox Code Playgroud)

有趣的是类型签名Int?[]?,例如可选Array的可选项Int.这感觉就像一个错误,但也许我对语法缺少了一些东西.我已经查看了一些语言参考但尚未找到答案.

更明确的Array<Int?>类型初始化程序按预期工作

let b: Int?[] = Array<Int?>(count: 10, repeatedValue:nil)
// compiles fine
Run Code Online (Sandbox Code Playgroud)

有没有其他人遇到这个并且可以解决一些问题?

编辑

结合非可选类型的额外工作示例来突出显示故障

let c: Int[] = Int[](count: 10, repeatedValue:0)
// non-optional shorthand works fine

class D { var foo = 1 }
let d: D[] = D[](count:10, repeatedValue:D())
// custom class works fine using the shorthand too

enum E { case a, b, c, d, e }
let e: E[] = E[](count:10, repeatedValue:.e)
// enums work too
Run Code Online (Sandbox Code Playgroud)

ave*_*Joe 5

斯威夫特3:

   let pageViews = [UIImageView?](repeating: nil, count: pageCount)
Run Code Online (Sandbox Code Playgroud)

斯威夫特2:

    let pageViews = [UIImageView?](count: pageCount, repeatedValue: nil)
Run Code Online (Sandbox Code Playgroud)