Swift 3.0 相对于 2.x 有很大变化。特别是因为命名习惯的改变,导致许多 Api 都发生了变化。总的趋势是让表示更简洁。

对旧的代码升级,大部分可以根据提示来进行更正。但也有的需要手动修改。

比如:

Swift 2.x:

UIColor->blueColor()

Swift 3.0:

UIColor->blue

Swift 2.x:

if () where ()

Swift 3.0:

if (), ()

Swift 2.x:

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #008400 }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo }
p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px }
span.s1 { color: #000000 }
span.s2 { }
span.s3 { color: #bb2ca2 }
span.s4 { color: #703daa }
span.s5 { color: #4f8187 }
span.s6 { color: #272ad8 }

// MARK: UITableViewDataSource

override func numberOfSectionsInTableView(tableView: UITableView) -> Int {

return data?.count ?? 0

}

Swift 3.0:

// MARK: UITableViewDataSource

override func numberOfSections(in tableView: UITableView) -> Int {

return data?.count ?? 0

}

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa }
span.s1 { }
span.s2 { color: #000000 }

CGPointZero -> CGPoint.zero

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa }
span.s1 { }

SequenceType -> Sequence

CKErrorCode -> CKError

封闭就是任性!想怎么改就怎么改。开始说写的越详细越易读,结果搞得太过了。现在开始精简了。

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa }
span.s1 { }

Swift 2.x -> Swift 3.0的更多相关文章

  1. 在同个工程中使用 Swift 和 Objective-C(Swift 2.0更新)-b

    本节包含内容: Mix and Match 概述(Mix and Match Overview) 在同个应用的 target 中导入(Importing Code from Within the Sa ...

  2. Swift互用性: 使用Objective-C特性编写Swift类(Swift 2.0版)-b

    本节包括内容: 继承Objective-C的类(Inheriting from Objective-C Classes) 采用协议(Adopting Protocols) 编写构造器和析构器(Writ ...

  3. iOS Swift 模块练习/swift基础学习

    SWIFT项目练习     SWIFT项目练习2 iOS Swift基础知识代码 推荐:Swift学习使用知识代码软件 0.swift中的宏定义(使用方法代替宏) 一.视图  +控件 1.UIImag ...

  4. swift.org - About Swift 官网关于notes

    About Swifthtml, body {overflow-x: initial !important;}html { font-size: 14px; } body { margin: 0px; ...

  5. 对象存储 - Swift 原理 及 Swift+keystone+dashboard 架构搭建

    1. 原理介绍 Swift 架构.原理及功能: http://www.cnblogs.com/sammyliu/p/4955241.html 总结的很详细也很全面,受益匪浅,感谢分享. 2. keys ...

  6. iOS开发零基础--Swift篇:Swift中数据类型

    Swift类型的介绍 Swift中的数据类型也有:整型/浮点型/对象类型/结构体类型等等 先了解整型和浮点型 整型 有符号 Int8 : 有符号8位整型 Int16 : 有符号16位整型 Int32 ...

  7. 总结swift 1.2适配swift2.0遇到的改变

    swift1.2适配swift2.0 以下列举的是我在项目中遇到的需要修改的,基本常见的问题就没有罗列了. 1.find函数变成了为indexOf 2.sort变成了sortInPlace 3.sor ...

  8. 【读书笔记】The Swift Programming Language (Swift 4.0.3)

    素材:Language Guide 初次接触 Swift,建议先看下 A Swift Tour,否则思维转换会很费力,容易卡死或钻牛角尖. 同样是每一章只总结3个自己认为最重要的点.这样挺好!强迫你去 ...

  9. 4 字符串 Swift/Objective -C ——《Swift3.0从入门到出家》

    4 字符串   Swift and Object-C 字符串由多个字符组成,使用 “” 引起的内容 swift语言中提供了两种字符串:可变字符串和不可变字符串 可变字符串:字符串的内容可以修改,字符串 ...

随机推荐

  1. WPF中如何将ListViewItem双击事件绑定到Command

    今天的博客将介绍如何实现ListViewItem双击事件绑定到ViewModel中的Command.实现方法借助了Style中的EventSetter,请看下面的详细代码: <ListView ...

  2. 在IntelliJ IDEA中添加框架支持时找不到Hibernate的解决办法

    问题描述 第一次在Add Frameworks support界面中添加hibernate支持的时候,异常中断,导致没有成功添加. 第二次进入Add Frameworks support窗口时,发现找 ...

  3. MySQL - 问题集 - "Waiting for table metadata lock"(待完善)

    待完善.show processlist; 可参考1:http://blog.csdn.net/huochuangchuang/article/details/49423893 可参考2:http:/ ...

  4. 用Python写一个简单的Web框架

    一.概述 二.从demo_app开始 三.WSGI中的application 四.区分URL 五.重构 1.正则匹配URL 2.DRY 3.抽象出框架 六.参考 一.概述 在Python中,WSGI( ...

  5. 【面试】http协议知识

    一.什么是HTTP协议        HTTP协议是一种应用层协议,HTTP是HyperText Transfer Protocol(超文本传输协议)的英文缩写.HTTP可以通过传输层的TCP协议在客 ...

  6. LINQ绑定List到GridView

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...

  7. Android之UI编程(一):线性布局

    package com.example.fk_layout; import android.app.Activity; import android.os.Bundle; public class L ...

  8. Symmetric Tree

    Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For e ...

  9. BZOJ1024&丝帛搜索

    题意: 还想二分的,发现并不用...那么直接搜索就水过吧... /*================================================================= ...

  10. js汉字与拼音互转终极方案,附简单的JS拼音输入法【转】

    github项目地址:https://github.com/liuxianan/pinyinjs 完整demo演示:http://demo.liuxianan.com/pinyinjs/ 汉字转拼音: ...