4

A quite general question. What exact syntax should I use instead of CGRectMake while coding in Swift 3?

Here is the code I would like to convert from swift 2 - 3:

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

Thanks for the help!

Milad Faridnia
  • 8,038
  • 13
  • 63
  • 69
user6155249
  • 119
  • 2
  • 11
  • Thanks, I have already seen this thread. I get the same error but mu usage of CGRectMake is different, so the recommended solution does not work. I can send a screenshot of how I use CGRectMake in my code in a few hours. – user6155249 Aug 02 '16 at 10:41

1 Answers1

14

in Swift 3.0 this can be use

let rect = CGRect(x: 0, y: 0, width: 50, height: 50)

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

Alupotha
  • 8,014
  • 4
  • 43
  • 45
  • Thanks! But how do I apply it in this line of code for example: { let size = text.boundingRectWithSize(CGSizeMake(view.frame.width - 26, 2000), options: NSStringDrawingOptions.UsesFontLeading.union(.UsesLineFragmentOrigin), context: nil).size} – user6155249 Aug 02 '16 at 10:48