Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Ceonn

macrumors newbie
Original poster
Jul 27, 2016
4
0
Can someone please help me with a some conversion from swift2 to swift3? Here are the three lines written in swift2 and would like this functioning in swift3:


Code:
return CGSizeMake(view.frame.width, 80)
layout.headerReferenceSize = CGSizeMake(view.frame.width, 50)
return CGSizeMake(view.frame.width, size.height + 16)

Thanks in advance!
 
With Swift 3, you can initialize a CGSize and CGRect directly through the constructor:

Code:
let size = CGSize(width: 150, height: 150)
Code:
let rect = CGRect(x: 10, y: 10, width: 150, height: 150)
 
Thanks Mascots. I have seen this on a few threads on different forums and all, but to be more on point I am having issues implementing that into the code I listed above... It would be great if you have the possibility to maybe show me how it's done with my code.

Appreciate the help!
 
Thanks Mascots. I have seen this on a few threads on different forums and all, but to be more on point I am having issues implementing that into the code I listed above... It would be great if you have the possibility to maybe show me how it's done with my code.

Appreciate the help!

Code:
return CGSize(width: view!.frame.width, height: CGFloat(80.0))
layout.headerReferenceSize = CGSize(width: view!.frame.width, height: CGFloat(50.0))
return CGSize(width: view!.frame.width, height: size.height + CGFloat(16.0))
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.