免费开源的iOS开发学习平台

- swift -

Swift语法介绍: 函数关键字(inout)
inout当函数体内修改参数的值,需要反馈到函数外时,需要把参数添加inout关键字var dynamicName:String = "jack"func function4...
Swift语法介绍: 函数嵌套
函数嵌套函数嵌套的主要好处在于可以对外屏蔽不必要的功能func operation(operationType:String, a:Int, b: Int) -> Int { ...
Swift语法介绍: 函数对象
函数赋值给常量func add(a:Int, b:Int) -> Int { return a + b}//函数作为对象,赋值给常量let myAdd = addvar result...
Swift语法介绍: 函数func基础
函数定义//函数定义形式:func 函数名(参数:类型, 参数:类型, ...) -> 返回值 { 函数体 }func add(a: Int, b:Int) -> Int { ...
Swift语法介绍: 字典
字典初始化//[key类型:value值类型]var dict1:[String: Int]dict1 = ["Math":98, "English": ...
Swift语法介绍: 判断
if/else判断//简单判断let isSuccess = trueif isSuccess { print("success!")}else { print(...
Swift语法介绍: 循环
普通for循环//传统写法for var i = 0; i < 10; i++ { print("the current i Value: \(i)")}//sw...