自动将CGRectMake更新为Swift 3中的CGRect [英] Update CGRectMake to CGRect in Swift 3 Automatically
问题描述
现在已经在Swift 3.0中删除了CGRectMake,CGPointMake,CGSizeMake等,有没有办法自动更新所有初始化,如从 CGRectMake(0,0,w,h)到CGRect( X:0,Y:0,宽度:W,高度: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.
当我将代码转换为当前Swift语法时,不确定Apple为什么不自动转换它...
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语法。 ..
然后按照屏幕提示。
这将解决您的语法问题,您不必为所有各种删除的函数创建新函数。
This will solve your syntax issues and you won't have to make new functions for all of the various removed functions.
这篇关于自动将CGRectMake更新为Swift 3中的CGRect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!