原文:Swift学习笔记(一)搭配环境以及代码运行成功1、Swift是啥?百度去!度娘告诉你它是苹果最新推出的编程语言,比c,c++,objc要高效简单。能够开发ios,mac相关的app哦!是苹果以后大力推广的语言哦!2、Swift给你带来什么机会?当初你觉得objc太难,学ios学到一半放弃拉,...
分类:
其他好文 时间:
2014-06-06 11:05:17
阅读次数:
211
概览 Swift
的条件语句包含if和switch,循环语句包含for-in、for、while和do-while,循环/判断条件不需要括号,但循环/判断体(body)必需括号:1
let individualScores = [75, 43, 103, 87, 12]2 var teamScor....
分类:
其他好文 时间:
2014-06-06 09:15:21
阅读次数:
192
创建和使用类 Swift 使用class创建一个类,类可以包含字段和方法:1 class
Shape {2 var numberOfSides = 03 func simpleDescription () -> String {4 return
"A shape w...
分类:
其他好文 时间:
2014-06-06 09:12:07
阅读次数:
217
```cppenum Iter: Int{ case s1=0, s2, s3, s4
mutating func next(){ if self == .s4 { self = .s1 return } ...
分类:
其他好文 时间:
2014-06-06 09:07:38
阅读次数:
215
1简介今天凌晨Apple刚刚发布了Swift编程语言,本文从其发布的书籍《The Swift
Programming Language》中摘录和提取而成。希望对各位的iOS&OSX开发有所帮助。Swift是供iOS和OS
X应用编程的新编程语言,基于C和Objective-C,而却没有C的一些兼容约...
分类:
移动开发 时间:
2014-06-06 09:05:37
阅读次数:
400
枚举 使用enum创建枚举——注意 Swift 的枚举可以关联方法: 1 enum Rank:
Int { 2 case Ace = 1 case Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten 3
case Jack, Q...
分类:
其他好文 时间:
2014-06-06 08:30:54
阅读次数:
285
Swift is a new programming language for iOS and OS
X apps that builds on the best of C and Objective-C, without the constraints of
C compatibility.Swi...
分类:
其他好文 时间:
2014-06-06 08:28:23
阅读次数:
187
Hello, world 类似于脚本语言,下面的代码即是一个完整的 Swift 程序。1
println ("Hello, world")变量与常量 Swift 使用var声明变量,let声明常量。1 var myVariable = 422
myVariable = 503 let myCon.....
分类:
其他好文 时间:
2014-06-06 08:25:46
阅读次数:
240
Swift 使用来声明泛型函数或泛型类型:1 func repeat(item: ItemType,
times: Int) -> ItemType[] {2 var result = ItemType[]()3 for i in 0..times {4
result...
分类:
其他好文 时间:
2014-06-06 07:52:02
阅读次数:
299
协议 Swift 使用protocol定义协议:1 protocol
ExampleProtocol {2 var simpleDescription: String { get }3 mutating func adjust
()4 }类型、枚举和结构都可以实现(adopt)协议...
分类:
其他好文 时间:
2014-06-06 07:48:38
阅读次数:
302