Re: Silly question on extending NSObject.

2019-02-21 Thread Jens Alfke


> On Feb 20, 2019, at 5:11 PM, Alex Zavatone  wrote:
> 
> Commenting out #import “NSObject+AutoDescribe.h” in the .pch does cause an 
> invalid selector build error if autoDescribe is used in any class file, but 
> you can enter it on an object from the debugger.

The warning/error is just because the compiler hasn’t seen that selector 
anywhere, so it doesn’t know it’s valid. You can fix it by #including the 
AutoDescribe header in that source file. Or create a prefix header and #include 
it there.

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Silly question on extending NSObject.

2019-02-20 Thread Alex Zavatone
Odd.  I just looked at a test app I have for testing the autoDescribe extension 
to NSObject in Xcode 10.1 for iOS.

Commenting out #import “NSObject+AutoDescribe.h” in the .pch does cause an 
invalid selector build error if autoDescribe is used in any class file, but you 
can enter it on an object from the debugger.

po [thisObject autoDescribe]



Sent from my iPhone

> On Feb 19, 2019, at 8:31 PM, Alex Zavatone  wrote:
> 
> 
>>> On Feb 19, 2019, at 4:15 PM, Jens Alfke  wrote:
>>> 
>>> Is there a more modern way to do this than using a .pch?
>> 
>> You don’t need a PCH for this. If you declare the category in an @interface 
>> or @implementation that gets parsed as part of your target, it’ll exist. 
>> Same for the methods in the category. It doesn’t matter whether the 
>> interface is parsed in every source file or not.
>> 
>> —Jens
> 
> Well, I’ll be.  It appears you are correct.  Now, why was it that a few years 
> back, I ended up thinking that I needed to import it to get it to work?  
> H.
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Silly question on extending NSObject.

2019-02-19 Thread Rob Petrovec


> On Feb 19, 2019, at 7:23 PM, Alex Zavatone  wrote:
> 
> 
>> On Feb 19, 2019, at 4:15 PM, Jens Alfke  wrote:
>> 
>> 
>> 
>>> On Feb 19, 2019, at 1:23 PM, Alex Zavatone >> > wrote:
>>> 
>>> In most Objective-C projects I add an autodescribe category on NSObject and 
>>> put the import for the category header into a .pch for the project so that 
>>> it will be available for every class in the project.
>>> This lets me dump an object’s properties and values at Will in the debugger.
>> 
>> 
>> I’m not sure what this does that the existing -description and 
>> -debugDescription methods don’t do?
> 
> This.
> 
> (lldb) po self.data
> 
> 
> (lldb) po [self.data description]
> 
> 
> (lldb) po [self.data autoDescribe]
If you override -debugDescription in your custom classes to spew 
whatever you want them to spew, you can just do ‘po self.data’ in the debugger 
and it will spew out your custom data.

—Rob

 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Silly question on extending NSObject.

2019-02-19 Thread Alex Zavatone

> On Feb 19, 2019, at 4:15 PM, Jens Alfke  wrote:
> 
>> Is there a more modern way to do this than using a .pch?
> 
> You don’t need a PCH for this. If you declare the category in an @interface 
> or @implementation that gets parsed as part of your target, it’ll exist. Same 
> for the methods in the category. It doesn’t matter whether the interface is 
> parsed in every source file or not.
> 
> —Jens

Well, I’ll be.  It appears you are correct.  Now, why was it that a few years 
back, I ended up thinking that I needed to import it to get it to work?  H.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Silly question on extending NSObject.

2019-02-19 Thread Alex Zavatone

> On Feb 19, 2019, at 4:15 PM, Jens Alfke  wrote:
> 
> 
> 
>> On Feb 19, 2019, at 1:23 PM, Alex Zavatone > > wrote:
>> 
>> In most Objective-C projects I add an autodescribe category on NSObject and 
>> put the import for the category header into a .pch for the project so that 
>> it will be available for every class in the project.
>> This lets me dump an object’s properties and values at Will in the debugger.
> 
> 
> I’m not sure what this does that the existing -description and 
> -debugDescription methods don’t do?

This.

(lldb) po self.data


(lldb) po [self.data description]


(lldb) po [self.data autoDescribe]
[DataStorage {fullRootServicesURL: NSString = "http://localhost/; 
rootServicesURL: "http://localhost/; 
preferences: NSUserDefaults =  
contentList: NSArray = (
{
fileTypeKey = ".png"
imageKey = "Intro Page 1"
nameKey = "No Lines, No Waiting."
},
{
fileTypeKey = ".png"
imageKey = "Intro Page 2"
nameKey = "Am I Eligible?"
},
{
fileTypeKey = ""
imageKey = "Intro Page 3"
nameKey = "Scan Your License."
},
{
fileTypeKey = ".png"
imageKey = "Intro Page 4"
nameKey = "Enter Credit Card"
},
{
fileTypeKey = ".png"
imageKey = "Intro Page 5"
nameKey = "All Done."
},
{
fileTypeKey = ".png"
imageKey = "Intro Page 6"
nameKey = ""
},
{
fileTypeKey = ".png"
imageKey = "Intro Page 7"
nameKey = ""
}
) 
}]
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Silly question on extending NSObject.

2019-02-19 Thread Alex Zavatone

> On Feb 19, 2019, at 3:37 PM, Rob Petrovec  wrote:
> 
> Why not use/override -description or -debugDescription instead of 
> re-inventing the wheel?
> 
> —Rob

I prefer having something that I know is for a specific purpose.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Silly question on extending NSObject.

2019-02-19 Thread Wim Lewis
On 19. feb. 2019, at 1:23 e.h., Alex Zavatone  wrote:
> In most Objective-C projects I add an autodescribe category on NSObject and 
> put the import for the category header into a .pch for the project so that it 
> will be available for every class in the project.
> 
> This lets me dump an object’s properties and values at Will in the debugger.
> 
> Is there a more modern way to do this than using a .pch?


Xcode's toolchain supports "prefix headers", which are essentially just 
additional import statements prepended to every file in the target. This gets 
the behavior you want, I think, without relying specifically on .pch files, 
which are an implementation detail of a particular compiler optimization.

In Xcode you can find this under "Language ▷ Prefix Header" or the 
"GCC_PREFIX_HEADER" build setting.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Silly question on extending NSObject.

2019-02-19 Thread Jens Alfke


> On Feb 19, 2019, at 1:23 PM, Alex Zavatone  wrote:
> 
> In most Objective-C projects I add an autodescribe category on NSObject and 
> put the import for the category header into a .pch for the project so that it 
> will be available for every class in the project.
> This lets me dump an object’s properties and values at Will in the debugger.


I’m not sure what this does that the existing -description and 
-debugDescription methods don’t do?

> Is there a more modern way to do this than using a .pch?

You don’t need a PCH for this. If you declare the category in an @interface or 
@implementation that gets parsed as part of your target, it’ll exist. Same for 
the methods in the category. It doesn’t matter whether the interface is parsed 
in every source file or not.

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Silly question on extending NSObject.

2019-02-19 Thread Keary Suska
Rob, how, exactly, would Alex do that such that all objects inheriting from 
NSObject will automatically have the implementation, which seems to be the goal?

The issue with .pch, as I understand it, is that Xcode wants to get away from 
using precompiled headers, and there are various philosophical and practical 
reasons for doing so, which you can google on. Further, .pch files are not 
intended to be a global import, although that is what many developers 
(including myself) have used them for.

In your case you can simply put the import in a place that you know will be 
loaded first, such as your App delegate class.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

> On Feb 19, 2019, at 2:37 PM, Rob Petrovec  wrote:
> 
> Why not use/override -description or -debugDescription instead of 
> re-inventing the wheel?
> 
> —Rob
> 
>> On Feb 19, 2019, at 2:23 PM, Alex Zavatone  wrote:
>> 
>> Sorry.  Second try.
>> 
>> In most Objective-C projects I add an autodescribe category on NSObject and 
>> put the import for the category header into a .pch for the project so that 
>> it will be available for every class in the project.
>> 
>> This lets me dump an object’s properties and values at Will in the debugger.
>> 
>> Is there a more modern way to do this than using a .pch?
>> 
>> I’ll also be adding one for Swift and am interested in approaches for both.  
>> 
>> Put the import in Settings.xcconfig files?
>> 
>> Thanks in advance
>> 
>> Sent from my iPhone
>> 
>>> On Feb 19, 2019, at 3:15 PM, Alex Zavatone  wrote:
>>> 
>>> In most Objective-C projects I add an autodescribe category and put the
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/petrock%40mac.com
>> 
>> This email sent to petr...@mac.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev%40esoteritech.com
> 
> This email sent to cocoa-...@esoteritech.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Silly question on extending NSObject.

2019-02-19 Thread Rob Petrovec
Why not use/override -description or -debugDescription instead of re-inventing 
the wheel?

—Rob

> On Feb 19, 2019, at 2:23 PM, Alex Zavatone  wrote:
> 
> Sorry.  Second try.
> 
> In most Objective-C projects I add an autodescribe category on NSObject and 
> put the import for the category header into a .pch for the project so that it 
> will be available for every class in the project.
> 
> This lets me dump an object’s properties and values at Will in the debugger.
> 
> Is there a more modern way to do this than using a .pch?
> 
> I’ll also be adding one for Swift and am interested in approaches for both.  
> 
> Put the import in Settings.xcconfig files?
> 
> Thanks in advance
> 
> Sent from my iPhone
> 
>> On Feb 19, 2019, at 3:15 PM, Alex Zavatone  wrote:
>> 
>> In most Objective-C projects I add an autodescribe category and put the
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/petrock%40mac.com
> 
> This email sent to petr...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Silly question on extending NSObject.

2019-02-19 Thread Alex Zavatone
Sorry.  Second try.

In most Objective-C projects I add an autodescribe category on NSObject and put 
the import for the category header into a .pch for the project so that it will 
be available for every class in the project.

This lets me dump an object’s properties and values at Will in the debugger.

Is there a more modern way to do this than using a .pch?

I’ll also be adding one for Swift and am interested in approaches for both.  

Put the import in Settings.xcconfig files?

Thanks in advance

Sent from my iPhone

> On Feb 19, 2019, at 3:15 PM, Alex Zavatone  wrote:
> 
> In most Objective-C projects I add an autodescribe category and put the

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com