So I'm currently learning obj-c and came across this code in a header file that's provided by apple in CGGeometry.h header file.
struct
CGPoint {
CGFloat x;
CGFloat y;
};
typedef struct CG_BOXABLE CGPoint CGPoint;
I don't understand the last portion of the code. This part:
typedef struct CG_BOXABLE CGPoint CGPoint;
So from my C days I remember defining a struct using typedef saves you from having to call it like so:
struct CGPoint{
}
And instead call it like this:
CGPoint{
}
But, what is the CG_BOXABLE and CGPoint? Is it like an inheritance thing or something? I'm referring to the first CGPoint.
I believe it's a newly added feature, adding the ability to box the struct without having to add your own objc_boxable attributes.
See the radar that seemingly started this feature request: http://openradar.appspot.com/32486932
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