Q:

Get Screen size in Swift as Integer

For positioning an element random in the screen but within the boundarys I need the resolution/screen size in swift. I already fount out how to get it with CGGraphics. Unfortunately I have to calculate a bit and need it as type UInt32, not CGFloat. I cannot use casting that way. Any ideas?
let screenSize: CGRect = UIScreen.mainScreen().bounds
let screenWidth = screenSize.width
//What I want to do
let screenHeight = screenSize.height-arc4random_uniform(screenSize.height)

A:

If you want random X and Y positions for your element you can do something like this:
let screenSize = UIScreen.main.bounds
let randomXPos = CGFloat(arc4random_uniform(UInt32(screenSize.width)))
let randomYPos = CGFloat(arc4random_uniform(UInt32(screenSize.height)))

Swift 4.2
let screenSize = UIScreen.main.bounds
let randomXPos = CGFloat.random(in: 0..<screenSize.width)
let randomYPos = CGFloat.random(in: 0..<screenSize.height)

A:

To get the value direct in Int use this code 
var bounds: CGRect = UIScreen.mainScreen().bounds
    var w:Int  = Int(self.bounds.size.width)
    var h:Int  = Int(self.bounds.size.height)

All you have to do is that convert the returning value from CGFloat to Integer 
Use following code to Get the value of screen height width and then convert the CGFloat to Int 
var bounds: CGRect = UIScreen.mainScreen().bounds
var width:CGFloat = bounds.size.width
var height:CGFloat = bounds.size.height

SWIFT 4.2

let bounds: CGRect = UIScreen.main.bounds
let width:CGFloat = bounds.size.width
let height:CGFloat = bounds.size.height

