I've been using this macro in Objctive-C:
#define viewWidth self.view.frame.size.width
I am trying to figure out how I can get the closest thing possible in swift?
any idea?
thank you
I've been using this macro in Objctive-C:
#define viewWidth self.view.frame.size.width
I am trying to figure out how I can get the closest thing possible in swift?
any idea?
thank you
There is no support for macros in Swift. You could try declaring an extension:
extension UIViewController {
var width: CGFloat {
return self.view.frame.size.width
}
}
Then use self.width
instead of viewWidth
.