微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

哪个是声明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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐