|
isFlipped??
Hi,
I’m trying to find some docs on isFlipped. When I search for it in the XCode docs, it only brings up a reference in NSImage and that’s deprecated.
I’m overriding this on some Classes on
Hi,
I’m trying to find some docs on isFlipped. When I search for it in the XCode docs, it only brings up a reference in NSImage and that’s deprecated.
I’m overriding this on some Classes on
|
By
Dave
·
#296
·
|
|
Re: Difference between NSPoint, NSSize, NSRect and the CG Versions
Thanks a lot Quincey and Jens for your through explanation - I had imported some Mac code from another project which uses NSRect’s and as my original project was iOS this caused compile errors, so
Thanks a lot Quincey and Jens for your through explanation - I had imported some Mac code from another project which uses NSRect’s and as my original project was iOS this caused compile errors, so
|
By
Dave
·
#295
·
|
|
Re: Difference between NSPoint, NSSize, NSRect and the CG Versions
Opening up a macOS project and looking at the definition of NSPoint, I see:
So, it was the same size as CGPoint, but a different struct name, which was enough to create an ABI incompatibility. You
Opening up a macOS project and looking at the definition of NSPoint, I see:
So, it was the same size as CGPoint, but a different struct name, which was enough to create an ABI incompatibility. You
|
By
Quincey Morris
·
#294
·
|
|
Re: Getting class when instantiating a singleton
Sure, why not, at least for Obj-C? The method description says, "Allocates a new instance of the receiving class, sends it an init message, and returns the initialized object."
And I checked out
Sure, why not, at least for Obj-C? The method description says, "Allocates a new instance of the receiving class, sends it an init message, and returns the initialized object."
And I checked out
|
By
Steve Christensen
·
#293
·
|
|
Re: Difference between NSPoint, NSSize, NSRect and the CG Versions
Here are the definitions copied from my iOS SDK headers. The types/sizes for CGFloat and NS[U]Integer track the 32-/64-bit architecture used to build a particular executable.
typedef CGFLOAT_TYPE
Here are the definitions copied from my iOS SDK headers. The types/sizes for CGFloat and NS[U]Integer track the 32-/64-bit architecture used to build a particular executable.
typedef CGFLOAT_TYPE
|
By
Steve Christensen
·
#292
·
|
|
Re: Difference between NSPoint, NSSize, NSRect and the CG Versions
I don’t remember the exact details either, but one issue is that there are places in the Obj-C runtime/metadata/whatever where the @encode string of a method signature matters, and some similar
I don’t remember the exact details either, but one issue is that there are places in the Obj-C runtime/metadata/whatever where the @encode string of a method signature matters, and some similar
|
By
Quincey Morris
·
#291
·
|
|
Re: Difference between NSPoint, NSSize, NSRect and the CG Versions
I don't see how they could be incompatible if they're the same size. The only 4-byte floating point type is 'float', so if the CG and NS types are using the same-size values, how can they be different
I don't see how they could be incompatible if they're the same size. The only 4-byte floating point type is 'float', so if the CG and NS types are using the same-size values, how can they be different
|
By
Jens Alfke
·
#290
·
|
|
Re: Difference between NSPoint, NSSize, NSRect and the CG Versions
There are “really” four different SDKs:
— 32-bit macOS
— 64-bit macOS
— 32-bit iOS
— 64-bit iOS
They are different in the sense that certain basic C types (such as int and float) are
There are “really” four different SDKs:
— 32-bit macOS
— 64-bit macOS
— 32-bit iOS
— 64-bit iOS
They are different in the sense that certain basic C types (such as int and float) are
|
By
Quincey Morris
·
#289
·
|
|
Re: Difference between NSPoint, NSSize, NSRect and the CG Versions
Historical reasons. AppKit predates Core Graphics (it predates Apple's acquisition of NeXT.)
—Jens
Historical reasons. AppKit predates Core Graphics (it predates Apple's acquisition of NeXT.)
—Jens
|
By
Jens Alfke
·
#288
·
|
|
Re: Difference between NSPoint, NSSize, NSRect and the CG Versions
Well,
typedef CGRect NSRect;
So, it looks like they are one and the same thing? But in that case why are there two sets?
I’m just trying to understand what these different types are supposed to
Well,
typedef CGRect NSRect;
So, it looks like they are one and the same thing? But in that case why are there two sets?
I’m just trying to understand what these different types are supposed to
|
By
Dave
·
#287
·
|
|
Re: Difference between NSPoint, NSSize, NSRect and the CG Versions
Look at the types that back them.
Structs and CGFloats?
Look at the types that back them.
Structs and CGFloats?
|
By
Alex Zavatone
·
#286
·
|
|
Difference between NSPoint, NSSize, NSRect and the CG Versions
Hi,
Is there any real difference between NSPoint, NSRect, NSSize etc. and the CG versions?
I can use the CG Versions on Mac and iOS but the NS versions only on Mac.
If I only used the CG versions
Hi,
Is there any real difference between NSPoint, NSRect, NSSize etc. and the CG versions?
I can use the CG Versions on Mac and iOS but the NS versions only on Mac.
If I only used the CG versions
|
By
Dave
·
#285
·
|
|
Re: Getting class when instantiating a singleton
Yes.
I’m trying this out to see if this is valid.
From the headers for NSObject.h;
+ (instancetype)new OBJC_SWIFT_UNAVAILABLE("use object initializers instead");
From the Quick Help ins[pector
Yes.
I’m trying this out to see if this is valid.
From the headers for NSObject.h;
+ (instancetype)new OBJC_SWIFT_UNAVAILABLE("use object initializers instead");
From the Quick Help ins[pector
|
By
Alex Zavatone
·
#284
·
|
|
Re: Getting class when instantiating a singleton
That's "instance = [self new];", right? :)
That's "instance = [self new];", right? :)
|
By
Steve Christensen
·
#283
·
|
|
Re: Getting class when instantiating a singleton
I’m able to turn the sharedInstance method from being dependent on my changing the class name and being this:
@implementation CrewActionsDataSingleton
+ (instancetype)sharedInstance
{
static
I’m able to turn the sharedInstance method from being dependent on my changing the class name and being this:
@implementation CrewActionsDataSingleton
+ (instancetype)sharedInstance
{
static
|
By
Alex Zavatone
·
#282
·
|
|
Re: Getting class when instantiating a singleton
If saving developer effort is your goal, how about setting up a text snippet in Xcode, so that you can avoid the penalty of needlessly un-typed code?
(By "un-typed" mean in the language sense, not
If saving developer effort is your goal, how about setting up a text snippet in Xcode, so that you can avoid the penalty of needlessly un-typed code?
(By "un-typed" mean in the language sense, not
|
By
Ben Kennedy
·
#281
·
|
|
Re: Getting class when instantiating a singleton
It makes the code copy/paste-able. No dependency on the name of class you are adding it to.
It makes the code copy/paste-able. No dependency on the name of class you are adding it to.
|
By
Alex Zavatone
·
#280
·
|
|
Re: Getting class when instantiating a singleton
Why is this necessary? Apologies if I'm missing something obvious, but what's wrong with literally using DataSingleton (in your example)?
Even if the method is called on a subclass it should still
Why is this necessary? Apologies if I'm missing something obvious, but what's wrong with literally using DataSingleton (in your example)?
Even if the method is called on a subclass it should still
|
By
Ben Kennedy
·
#279
·
|
|
Re: Getting class when instantiating a singleton
Awesome. TY. +1
By
Alex Zavatone
·
#278
·
|
|
Re: Getting class when instantiating a singleton
No no - not:
static id *instance;
but
static id instance;
The id type is itself a pointer to an object.
- Jon
No no - not:
static id *instance;
but
static id instance;
The id type is itself a pointer to an object.
- Jon
|
By
Jon Gotow
·
#277
·
|