2

I'm building a class to handle with a basic graphic. I'm a newby and I'm on a self learning project to build small apps in Swift for IOS devices, since I found the language very easy to learn.

I've set in my class of type UIView two constants of type CGPoint:

let heigh = bounds.size.heigh
let width = bounds.size.width

These 2 variables are CGFloat, but I need them to be Int. Appreciate help to convert them to these type value.

Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523

1 Answers1

3

You should be able to convert the float value to an Integer like this:

let height = Int(bounds.size.height)
Scriptable
  • 19,402
  • 5
  • 56
  • 72