加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

数组 – [String]和Array之间的区别

发布时间:2020-12-14 04:59:02 所属栏目:百科 来源:网络整理
导读:哪个是声明Array和Dictionary的更好方法,我使用了两个: 阵列字符串 [串] 对我来说[String]在编码方面非常快,但实际上两者在编译器和性能方面有何不同,我们应该遵循哪一个? 解决方法 来自 Swift上的iOS开发者库… The type of a Swift array is written in
哪个是声明Array和Dictionary的更好方法,我使用了两个:

阵列<字符串>

[串]

对我来说[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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读