如何在Swift Ios中添加数组? [英] How Do I Add A Array In Swift Ios?

查看:123
本文介绍了如何在Swift Ios中添加数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想创建一个数据来自回调的数组。所以需要创建一个包含我从回调中得到的所有值的数组。这用于在iOS中使用Swift在前端UI中显示。



感谢您的帮助....

Hi,
I want to create an array where the data is coming from callback. so need to create an array with all the values i got from the callback. this is used to display in fronted UI in iOS using Swift.

Thanks for the help....

推荐答案

从原始文档中可以看出,Swift数组非常灵活,因此您可以使用方法 append 或运算符'+ ='向元素添加元素: https://developer.apple.com/library/ios/documentation/Swift /Conceptual/Swift_Programming_Language/CollectionTypes.html [ ^ ]。



这样,您可以将来自回调的数据(无论是什么)添加为数组元素。



-SA
As you can see from original documentation, Swift arrays are very flexible, so you can add elements to the array using the method append or the operator '+=': https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/CollectionTypes.html[^].

This way, you can add the data which comes from your callback (whatever it is) as array elements.

—SA


这篇关于如何在Swift Ios中添加数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆