gpt4 book ai didi

arrays - [String] 和 Array 的区别

转载 作者:搜寻专家 更新时间:2023-10-30 22:03:24 25 4
gpt4 key购买 nike

声明ArrayDictionary 哪个更好,我都用过:

Array<String>

[String]

对我来说[String]在编码方面非常快,但实际上两者在编译器和性能方面有何不同,我们应该遵循哪一个?

最佳答案

来自 Swift 上的 iOS 开发者库......

The type of a Swift array is written in full as Array< Element >, where Element is the type of values the array is allowed to store. You can also write the type of an array in shorthand form as [Element]. Although the two forms are functionally identical, the shorthand form is preferred and is used throughout this guide when referring to the type of an array.

https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/CollectionTypes.html

关于arrays - [String] 和 Array<String> 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34240602/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com