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

数组 – [String]和Array之间的区别,第1张

概述哪个是声明Array和Dictionary的更好方法,我使用了两个: 阵列<字符串> [串] 对我来说[String]在编码方面非常快,但实际上两者在编译器和性能方面有何不同,我们应该遵循哪一个? 来自 Swift上的iOS开发者库… The type of a Swift array is written in full as Array< Element >, where Element is 哪个是声明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

总结

以上是内存溢出为你收集整理的数组 – [String]和Array之间区别全部内容,希望文章能够帮你解决数组 – [String]和Array之间的区别所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1017471.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存