IOS开发-Swift新语言初见
Safe
Swift pairs increased type safety with type inference, restricts direct access to pointers, and automatically manages memory—making it easy to create secure, stable software.
funcconfigureLabels(labels:
UILabel[]) {
letlabelTextColor =
UIColor.greenColor()forlabel
in
labels {//
label inferred to be UILabellabel.textColor
=
labelTextColor}}
Modern
Swift includes optionals, generics, tuples, and other modern language features. Inspired by and improving upon Objective-C, Swift code feels natural to read and write.
letcities = ["London",
"San Francisco",
"Tokyo",
"Barcelona",
"Sydney"]letsortedCities =
sort(cities)
{
$0 <
$1 }iflet
indexOfLondon =
find(sortedCities,"London") {
println("London
is city number \(indexOfLondon
+
1)
in the list")}
Powerful
Take advantage of powerful pattern matching in Swift to write simple, expressive code. Format strings naturally with string interpolation. Use frameworks like Foundation and UIKit directly from Swift.
letsize = (20,
40)
switchsize {
caselet (width,
height)
where
width ==
height:println("square
with sides \(width)")case
(1..10,1..10):
println("small
rectangle")caselet (width,
height):
println("rectangle
with width \(width)
and height \(height)")}
Interactive
Use playgrounds to experiment with new technologies, analyze problems, and prototype user interfaces.

Fast
The Swift compiler applies advanced code analysis to tune your code for performance, letting you focus on writing great apps instead of on implementing complex optimizations.
IOS开发-Swift新语言初见的更多相关文章
- iOS开发Swift篇—(二)变量和常量
		
iOS开发Swift篇—(二)变量和常量 一.语言的性能 (1)根据WWDC的展示 在进行复杂对象排序时Objective-C的性能是Python的2.8倍,Swift的性能是Python的3.9倍 ...
 - 李洪强iOS开发Swift篇—02_变量和常量
		
李洪强iOS开发Swift篇—02_变量和常量 一.语言的性能 (1)根据WWDC的展示 在进行复杂对象排序时Objective-C的性能是Python的2.8倍,Swift的性能是Python的3. ...
 - iOS开发系列--C语言之基础知识
		
概览 当前移动开发的趋势已经势不可挡,这个系列希望浅谈一下个人对IOS开发的一些见解,这个IOS系列计划从几个角度去说IOS开发: C语言 OC基础 IOS开发(iphone/ipad) Swift ...
 - iOS开发Swift篇—(一)简单介绍
		
iOS开发Swift篇—简单介绍 一.简介 Swift是苹果于2014年WWDC(苹果开发者大会)发布的全新编程语言 Swift在天朝译为“雨燕”,是它的LOGO 是一只燕子,跟Objective-C ...
 - iOS开发Swift篇—(三)字符串和数据类型
		
iOS开发Swift篇—(三)字符串和数据类型 一.字符串 字符串是String类型的数据,用双引号""包住文字内容 let website = "http://www ...
 - iOS开发Swift篇—(四)运算符
		
iOS开发Swift篇—(四)运算符 一.运算符 1.Swift所支持的部分运算符有以下一些 赋值运算符:= 复合赋值运算符:+=.-= 算术运算符:+.-.*./ 求余运算符:% 自增.自减运算符: ...
 - iOS开发Swift篇—(六)流程控制
		
iOS开发Swift篇—(六)流程控制 一.swift中的流程控制 Swift支持的流程结构如下: 循环结构:for.for-in.while.do-while 选择结构:if.switch 注意:这 ...
 - iOS开发Swift篇—(九)属性
		
iOS开发Swift篇—(九)属性 一.类的定义 Swift与Objective-C定义类的区别 Objective-C:一般需要2个文件,1个.h声明文件和1个.m实现文件 Swift:只需要1个. ...
 - iOS开发Swift篇—简单介绍
		
iOS开发Swift篇—简单介绍 一.简介 Swift是苹果于2014年WWDC(苹果开发者大会)发布的全新编程语言 Swift在天朝译为“雨燕”,是它的LOGO 是一只燕子,跟Objective-C ...
 
随机推荐
- 第七个问题(枚举和set)
			
set添加元素是基于equals和hashCode函数来确定的两个要素是否是同一物体. public final boolean equals(Object other) 当指定对象等于此枚举常量时, ...
 - WWDC 2014 Session 205/217 Extension 注意事项
			
基于阅读下面的内容205和217的PDF做笔记.没有深入研究. 205 Creating Extensions for iOS and OS X, Part 1 217 Creating Extens ...
 - 一个轻量级rest服务器
			
RestServer直接发布数据库为json格式提供方法 RestSerRestServer直接发布数据库为json格式 支持MySQL,SqlServer,Oracle直接发布为Rest服务, 返回 ...
 - 在android移动设备上登录gmail的时候报password错误解决方法!!!!
			
今天刚发现的解决的方法:就是登录web端的gmail,查看收件箱应该有no-reply这一帐户给你发过邮件(假设没有,你在移动设备上登录一下gmail).照着邮件里的说明去做,就是生成一个专门应用的p ...
 - Python中国的学习方式处理问题
			
a = '你们' 至 str 物 a = u'你们' 至 unicode 物 1. >>> print 'u' + '你们' >>> u欢 输出乱码 2. > ...
 - 解决一bug的流程复盘
			
听同事说有一个功能不好使了,当时有事,过了一段时间来看看这个bug 解决问题时,看的是老的日志,根据老日志看来看去没有发现问题,觉得很困惑 然后手动执行了一下,发现问题没有重现.与另一个团队的同事沟通 ...
 - PHP邮件发送(转)
			
php带有内置的mail() 发送邮件函数,但是较为繁琐:建议上网下载一个PHPMailer:
 - HDOJ 3966 Aragorn's Story
			
树链拆分+树阵 (进入坑....) Aragorn's Story Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/327 ...
 - Linux:闪光的宝石,智慧(下一个)
			
2005年4月7日.Linus Torvalds公布了一款新型通用工具软件包,叫做"Git"(the Git source code management system).&quo ...
 - 基于PHP的crontab定时任务管理
			
BY JENNER · 2014年11月10日· 阅读次数:6 linux的crontab一直是server运维.业务开展的利器.但当定时任务增多时,管理和迁移都变得非常麻烦,并且easy出问题.以下 ...