Update CGRectMake to CGRect in Swift 3 Automatically

后端 未结 3 426
迷失自我
迷失自我 2020-12-14 13:55

Now that CGRectMake , CGPointMake, CGSizeMake, etc. has been removed in Swift 3.0, is there any way to automatically update all initializations like from CGRectMake(0,

3条回答
  •  臣服心动
    2020-12-14 14:49

    The simplest solution is probably just to redefine the functions Apple took away. Example:

    func CGRectMake(_ x: CGFloat, _ y: CGFloat, _ width: CGFloat, _ height: CGFloat) -> CGRect {
        return CGRect(x: x, y: y, width: width, height: height)
    }
    

    Put that in your module and all calls to CGRectMake will work again.

提交回复
热议问题