swift 3.0的语法变化

运算符变化

>>>>>>3.0

var add = 2;

add += 1;

add -= 1;

>>>>>>>2.3

var add = 2;

add++;

add--;

selector的swift风格化

>>>>>>>>>>3.0

btn.addTarget(self, action:#selector(ViewController.click), forControlEvent: UIControlEvent.TouchUpInside)

>>>>>>>>>>2.3

btn.addTarget(self, action:"click", forControlEvent: .TouchUpInside)

枚举变化 (首字母小写)

>>>>>>>>>3.0

enum Direction: String {

      case east = "east"

      case south = "south"

      case west = "west"

      case north = "north"

}

>>>>>>>>>2.3

enum Direction: String {

case East = "east"

case South = "south"

case West = "west"

case North = "north"

}

你可能感兴趣的:(swift 3.0的语法变化)