摘要: Closures Are Reference Types In the example above, incrementBySeven and incrementByTen are constants, but the closures these constants refer to are st 阅读全文
posted @ 2018-12-29 19:21 zzfx 阅读(207) 评论(0) 推荐(0)
摘要: @autoclosure 在闭包前面加上@autoclosure func or(first:Bool,@autoclosure second:()->Bool) -> Bool { if first { return true } else { return second() } } 再来看下调用 阅读全文
posted @ 2018-12-29 19:15 zzfx 阅读(261) 评论(0) 推荐(0)
摘要: 函数类型(Function Types) 每个函数都有种特定的函数类型,由函数的参数类型和返回类型组成。 例如: 这个例子中定义了两个简单的数学函数:addTwoInts 和 multiplyTwoInts。这两个函数都传入两个 Int类型, 返回一个合适的Int值。 这两个函数的类型是 (Int, 阅读全文
posted @ 2018-12-29 18:40 zzfx 阅读(1279) 评论(0) 推荐(0)
摘要: 功能:model = modelType.transform(rawdata) 使用分析: 使用机制:继承+实现配置+使用; 需要自己实现什么? 设计分析: 工具模块?机制模块?model基类? 生成机制? 如何组织? 接口:通过继承使用接口; 主干类: JSONDeserializer<T: Ha 阅读全文
posted @ 2018-12-29 17:16 zzfx 阅读(540) 评论(0) 推荐(0)
摘要: 一般情况下Swit要想调用obj-c,c或c++代码必须通过obj-c以及桥接文件才可以办到,但是使用@_silgen_name,可以对于某些简单的代码,直接跳过桥接文件和.h头文件与C代码交互。 创建.c文件 #include <stdio.h> int add(int i, int j){ re 阅读全文
posted @ 2018-12-29 16:41 zzfx 阅读(459) 评论(0) 推荐(0)