使用特定代码在Swift 3中出现GCRectMake错误

use*_*249 4 syntax xcode swift swift3

一个相当普遍的问题.我应该使用什么样的语法而不是CGRectMake在Swift 3 中进行编码?

这是我想从swift 2 - 3转换的代码:

{let size = text.boundingRectWithSize(CGSizeMake(view.frame.width - 26, 2000), options: NSStringDrawingOptions.UsesFontLeading.union(.UsesLineFragmentOrigin), context: nil).size}
Run Code Online (Sandbox Code Playgroud)

谢谢您的帮助!

Alu*_*tha 14

在Swift 3.0中,这可以使用

let rect = CGRect(x: 0, y: 0, width: 50, height: 50)
Run Code Online (Sandbox Code Playgroud)

https://www.raywenderlich.com/135655/whats-new-swift-3