在 Swift 3 中自动将 CGRectMake 更新为 CGRect [英] Update CGRectMake to CGRect in Swift 3 Automatically

查看:11
本文介绍了在 Swift 3 中自动将 CGRectMake 更新为 CGRect的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在 CGRectMake 、 CGPointMake 、 CGSizeMake 等已在 Swift 3.0 中删除,有什么方法可以自动更新所有初始化,例如从 CGRectMake(0,0,w,h) 到 CGRect(x:0),y:0,width:w,height:h).手动过程是.. 相当痛苦.

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,0,w,h) to CGRect(x:0,y:0,width:w,height:h). Manual process is.. quite a pain.

不确定为什么 Apple 在我将代码转换为 Current Swift Syntax 时不自动转换它...

Not sure why Apple don't auto convert this when I convert the code to Current Swift Syntax...

推荐答案

Apple 实际上确实提供了此功能.你所要做的就是去:

Apple actually does provide this feature. All you have to do is go to:

编辑 > 转换 > 到最新的 Swift 语法...

然后按照屏幕上的提示进行操作.

And then follow the onscreen prompts.

这将解决您的语法问题,而且您不必为所有已删除的函数创建新函数.

This will solve your syntax issues and you won't have to make new functions for all of the various removed functions.

这篇关于在 Swift 3 中自动将 CGRectMake 更新为 CGRect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆