How do you create an immutable array in Swift?

后端 未结 5 801
臣服心动
臣服心动 2020-11-30 04:16

How do I create an immutable array in Swift?

A superficial reading of the docs would suggest you can just do

let myArray = [1,2,3]

5条回答
  •  粉色の甜心
    2020-11-30 04:47

    Seems to be a bug and to be fixed soon.

    Cited from Apple dev forum:

    Question:

    Inconsistency with let for Array and Dictionary

    Final answer:

    This is considered to be a bug, not a feature, and will be fixed in a later Beta.
    -Chris

提交回复
热议问题