So you can get the width and height of the UIScreen as follows...
public var screenWidth: CGFloat {
return UIScreen.main.bounds.width
}
public var screenHeight: CGFloat {
return UIScreen.main.bounds.height
}
But how can you get the width and height of a UIView?
extension UIView {
public var viewWidth: CGFloat {
return self.frame.size.width
}
public var viewHeight: CGFloat {
return self.frame.size.height
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With