Men的博客

欢迎光临!

0%

Swfit学习-懒加载

MARK: - 懒加载

lazy var tableView:UITableView = {

let tableView = UITableView(frame: CGRectZero, style: UITableViewStyle.Plain)

tableView.delegate = self

tableView.dataSource = self

tableView.backgroundColor = Color_GlobalBackground

tableView.showsHorizontalScrollIndicator = false

tableView.showsVerticalScrollIndicator = false

tableView.separatorStyle = UITableViewCellSeparatorStyle.None

tableView.sectionFooterHeight = 0.0001

tableView.sectionHeaderHeight = 0.0001

tableView.registerNib(UINib(nibName: “BaseStrategyCell”, bundle: NSBundle.mainBundle()), forCellReuseIdentifier: cellReuseIdentifier)

return tableView

}()

lazy var dataArray:NSMutableArray = {

var dataArray = NSMutableArray();

return dataArray

}()

关键字和标点符号
下面这些被保留的关键字不允许用作标识符,除非使用反引号转义,具体描述请参考 标识符。除了 inout、var 以及 let 之外的关键字可以用作某个函数声明或者函数调用当中的外部参数名,不用添加反引号转义。

用在声明中的关键字: associatedtype、class、deinit、enum、extension、func、import、init、inout、internal、let、operator、private、protocol、public、static、struct、subscript、typealias 以及 var。
用在语句中的关键字:break、case、continue、default、defer、do、else、fallthrough、for、guard、if、in、repeat、return、switch、where 以及 while。
用在表达式和类型中的关键字:as、catch、dynamicType、false、is、nil、rethrows、super、self、Self、throw、throws、true、try、#column、#file、#function 以及 #line。
用在模式中的关键字:_。
以井字号 (#) 开头的关键字:#available、#column、#else#elseif、#endif、#file、#function、#if、#line 以及 #selector。
特定上下文中被保留的关键字: associativity、convenience、dynamic、didSet、final、get、infix、indirect、lazy、left、mutating、none、nonmutating、optional、override、postfix、precedence、prefix、Protocol、required、right、set、Type、unowned、weak 以及 willSet。这些关键字在特定上下文之外可以被用做标识符。

Swift是一门支持多编程范式的语言,既支持面向对象编程,也支持面向协议编程,同时还支持函数式编程。在项目开发过程中,控制器和视图部分由于使用系统框架,应更多采用面向对象编程的方式;而模型或业务逻辑等自定义类型部分,则应优先考虑面向协议编程。
cd /Users/heqin/men123456.github.io
npm install hexo -server –save
hexo server
hexo clean && hexo g && hexo d