“Swift is a new programming language for iOS and OS X app development. Nonetheless, many parts of Swift will be familiar from your experience of developing in C and Objective-C.”

“Swift provides its own versions of all fundamental(基本的,根本的) C and Objective-C types, including Int for integers; Double and Float for floating-point values; Bool for Boolean values; and String for textual data. Swift also provides powerful versions of the two primary collection types, Array and Dictionary, as described in Collection Types.”
“Like C, Swift uses variables to store and refer to values by an identifying name. Swift also makes extensive use of variables whose values cannot be changed. These are known as constants, and are much more powerful than constants in C. Constants are used throughout Swift to make code safer and clearer in intent when you work with values that do not need to change.”

“In addition to familiar types, Swift introduces advanced types not found in Objective-C. These include tuples, which enable you to create and pass around groupings of values. Tuples can return multiple values from a function as a single compound value.”

“Swift also introduces optional types, which handle the absence of a value. Optionals say either “there is a value, and it equals x” or “there isn’t a value at all”. Optionals are similar to using nil with pointers in Objective-C, but they work for any type, not just classes. Optionals are safer and more expressive than nil pointers in Objective-C and are at the heart of many of Swift’s most powerful features.

Optionals are an example of the fact that Swift is a type safe language. Swift helps you to be clear about the types of values your code can work with. If part of your code expects a String, type safety prevents you from passing it an Int by mistake. This enables you to catch and fix errors as early as possible in the development process.”

最新文章

  1. 阿里云服务器Linux CentOS安装配置(九)shell编译、打包、部署
  2. Floyd判最小环算法模板
  3. eclipse字体的设置
  4. The shortest problem
  5. isp和3a的联系与区别是什么?
  6. 【jsonp】
  7. linux下的rbenv和rails安裝
  8. 常用YUV转RGB代码
  9. webpack + vue 在dev和production模式下的小小区别
  10. redis list命令操作
  11. <自动化测试方案_9>第九章、持续集成平台搭建
  12. CGI,FastCGI,PHP-CGI与PHP-FPM区别详解【转】
  13. MySQL在Read Uncommitted级别下写操作加X锁
  14. Lakeshore 中文开发界面,示例项目,飞机大战 等 Lakeshore Chinese development interface, sample project, aircraft war, etc
  15. java中继承thread类的其他类的start()方法与run()方法
  16. 浅析Java 数组-基础详解
  17. Interval Sum I && II
  18. iOS Reachability检测网络状态
  19. MySQL 常用语法 之 DISTINCT
  20. oracle 内连接、外连接、自然连接、交叉连接练习

热门文章

  1. python常用绘图软件包记录
  2. 上传项目到Github
  3. web前端开发分享-css,js进阶篇
  4. A Full Hardware Guide to Deep Learning
  5. HDU3368+枚举
  6. Cocos2d-x内存自动释放机制--透彻篇
  7. asp.net中时间差的问题
  8. Linux下的绘图(流程图、UML、mindmap)工具
  9. C调用OPENSSL做REST服务客户端的例子
  10. [Quick-x]制作新手引导高亮区域方法之一:混合模式