“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.”

转载于:https://www.cnblogs.com/ghgyj/p/4048098.html

The Basics相关推荐

  1. appJSON[tabBar][0][pagePath] pages/basics/basics 需在 pages 数组中

    问题如下 出现这个问题的原因自己创建了basics和media然后自己并没有在 app.json 中pages没有声明路径 所以呢在pages中添加路径即可,

  2. unity镜像_通过镜像学习Unity Multiplayer Basics

    unity镜像 Unity is one of the most well-known and established engines for game development, and Mirror ...

  3. NFC Basics(基本NFC)——翻译自developer.android.com

    NFC Basics 关于收发NDEF格式的消息,以及相关的api. 非NDEFdata以及其它更深入技术请參见Advanced NFC. 在android端使用NDEF有两种情况: - 从标签读取N ...

  4. 稀疏性和L1正则化基础 Sparsity and Some Basics of L1 Regularization

    Sparsity 是当今机器学习领域中的一个重要话题.John Lafferty 和 Larry Wasserman 在 2006 年的一篇评论中提到: Some current challenges ...

  5. 【翻译】GitHub Pages Basics 基本使用帮助【一】GitHub Pages 是什么?

    https://help.github.com/articles/what-is-github-pages/ What is GitHub Pages? --> GitHub Pages 是什么 ...

  6. 线性代数问卷调查反馈——Find The Determinant III,Takahashi‘s Basics in Education and Learning

    文章目录 Find The Determinant III source code Takahashi's Basics in Education and Learning source code F ...

  7. Maven的pom.xml文件详解------The Basics

    转载自  Maven的pom.xml文件详解------The Basics Maven坐标 GroupId.artifactId和version构成了Maven的坐标(groupId和version ...

  8. 吴恩达 深度学习 编程作业(1-2.1)- Python Basics with Numpy

    Python Basics with Numpy (optional assignment) Welcome to your first assignment. This exercise gives ...

  9. Markdown: Basics (快速入门)

    声明: 这份文档派生(fork)于繁体中文版,在此基础上进行了繁体转简体工作,并进行了适当的润色.此文档用 Markdown 语法编写,你可以到这里查看它的源文件.「繁体中文版的原始文件可以查看这里」 ...

  10. 萌新向Python数据分析及数据挖掘 第二章 pandas 第二节 Python Language Basics, IPython, and Jupyter Notebooks...

    Python Language Basics, IPython, and Jupyter Notebooks In [5]: import numpy as np #导入numpy np.random ...

最新文章

  1. 实现 连续15签到记录_MySQL和Redis实现用户签到,你喜欢怎么实现?
  2. Redis序列化配置类
  3. (转载)linux下的find文件查找命令与grep文件内容查找命令
  4. 天使投资家李镇樟:如何培养世界级企业家
  5. [Swift]LeetCode781. 森林中的兔子 | Rabbits in Forest
  6. ugui源码_UGUI 源码笔记(一)文件结构和部分组件使用
  7. python bool 转vc int_史上最全的 Python 3 类型转换指南
  8. LibreOJ #6001. 「网络流 24 题」太空飞行计划 最大权闭合图
  9. 推荐 | 微软SAR近邻协同过滤算法解析(一)
  10. pythonweb测试_python的web自动化测试
  11. LINUX下载编译FriBidi
  12. 多维数据查询效率分析(2)
  13. Linux ida 代码,[分享][下载]IDA Pro 7.5 Linux Demo
  14. java7 xp版下载64位,xp32位系统可用最高版本jdk64位系统win10 64位系统
  15. 计算机制作节日贺卡教案,《制作节日贺卡》教学设计.doc
  16. 你真的不了解我的痛楚,请不要瞎说
  17. WPF实现拍照截图功能(WPFMediaKit 调用摄像头和拍照)
  18. 一万块人民币钱做本钱,如何在一年内合法赚一亿元?
  19. 【Java笔记】——将晦涩难懂的IO流形象化
  20. Android开发,你必须知道的四大天王。

热门文章

  1. hibernate 级联删除
  2. 高级软件工程第七次作业:东理三剑客团队作业-随笔5
  3. django+celery+rabitmq
  4. C#基础知识学习(2)string类中的方法
  5. Android笔记(八) Android中的布局——相对布局
  6. python中的函数修饰符
  7. Qt数据库编程_基本
  8. 主题:Centos6.4安装JDK
  9. 《Effective C#》读书笔记——条目10:使用可选参数减少方法重载的数量C#语言习惯...
  10. 计算机与新闻业未来发展,计算机学院举办“智创未来,谈思维与职业发展”活动...