官术网_书友最值得收藏!

Chapter 3. Using Collections and Cocoa Data Types

Once I got past the basic Hello World beginner applications, I quickly began to realize the shortcomings of variables, especially with the Mad Libs (http://en.wikipedia.org/wiki/Mad_Libs) style applications that I was starting to write. These applications requested that the user enter in numerous strings and I was creating a separate variable for each input field that the user entered. Having all of these separate variables quickly became very cumbersome. I remember talking to a friend about this and he asked me why I was not using arrays. At the time, I was not familiar with arrays, so I asked him to show me what they were. Even though he had a TI-99/4A and I had a Commodore Vic-20, the concept of arrays was the same. Even today, the arrays found in modern development languages have the same basic concepts as the arrays I used on my Commodore Vic-20. While it is definitely possible to create a useful application without using collections, when used right, collections do make application development significantly easier.

In this chapter, we will cover the following topics:

  • What is an array in Swift and how to use it?
  • What is a dictionary in Swift and how to use it?
  • What is a tuple in Swift and how to use it?
  • How to use Cocoa data types in Swift?
  • How to use Foundation data types in Swift?
主站蜘蛛池模板: 图片| 泸州市| 固始县| 岱山县| 拜城县| 微山县| 桑日县| 崇信县| 洪湖市| 化德县| 辽宁省| 横山县| 驻马店市| 龙陵县| 北票市| 衡山县| 民权县| 德阳市| 亳州市| 乾安县| 石台县| 卓尼县| 井陉县| 曲松县| 阜新市| 武清区| 碌曲县| 尖扎县| 南投市| 南投县| 广德县| 阿荣旗| 普洱| 蒙城县| 开江县| 南丰县| 兴安盟| 仪陇县| 西畴县| 乳山市| 双桥区|