Saturday, October 21, 2017

#1 2017-06-06 10:58:45 am

xmaslance
Member
Registered: 2017-04-05
Posts: 15

Referencing application class directly vs indirectly

Is there a (material) difference between referencing an Objective-C class using the class name directly versus the 'class' keyword with string "literal"?

Using NSURL as an example:

Applescript:

set theNSURL to current application's NSURL's fileURLWithPath:posixPath

Compared to:

Applescript:

set theNSURL to current application's class "NSURL"'s fileURLWithPath:posixPath

Thanks,
Lance

Offline

 

#2 2017-06-06 05:39:40 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5158

Re: Referencing application class directly vs indirectly

It's a good question. The only answer I can give is that the class version was used in Apple samples originally, but last I heard from one of the Apple team, the variable form was now preferred.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Online

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)