What is Best Way to Find List and Definition of $ASObjC NS Sort Keys?

###What is Best Way to Find List and Definition of NS Sort Keys?

I have this list of keys from a handler that @ccstone and @ShaneStanley wrote:

NSURLAttributeModificationDateKey
NSURLContentAccessDateKey
NSURLCreationDateKey
NSURLFileAllocatedSizeKey
NSURLFileSizeKey
NSURLLabelColorKey
NSURLLabelNumberKey
NSURLLocalizedLabelKey
NSURLLocalizedTypeDescriptionKey
NSURLNameKey
NSURLTotalFileAllocatedSizeKey
NSURLTotalFileSizeKey
NSURLTypeIdentifierKey

How do I get the definition for each key?
How do I get the complete list of sort keys that are available?

I’ve tried several google searches. The only one that provided anything useful is a search on the individual key name.
That gives me the definition for that key, but no links to the list of keys.
Of course, I could google each key, but I was hoping there was one page out there that would give me the list, with a table of the definition of each.

I don’t have a clue as to how to use @BillKopp’s database.
Can this be done there, Bill?

TiA for any help.

Search for the documentation for NSURL. It includes a list of NSURLResourceKeys, File Property Keys, and Volume Resource Keys.

@ccstone and @ShaneStanley:

Which key is best to use for sorting files/folders on Date Modified (as shown in Finder)?

From Apple’s NSURLResourceKey:

NSURLAttributeModificationDateKey
The time at which the resource’s attributes were most recently modified, returned as an NSDate object if the volume supports attribute modification dates, or nil if attribute modification dates are unsupported (read-only).

NSURLContentModificationDateKey
The time at which the resource was most recently modified, returned as an NSDate object if the volume supports modification dates, or nil if modification dates are unsupported (read-write).

In your script posted here, you suggested NSURLAttributeModificationDateKey.

If you want to match the Finder exactly, then a quick test shows it’s NSURLContentModificationDateKey. (Any change to content also changes the value for NSURLAttributeModificationDateKey, but not vice-versa.)

Jim,

Sorry Jim. I started working with translating the AS book and got a bit obsessed. I enclosed the help and glossary from the database in this post. The current version is A16. These are the latest versions of these documents. I included the help document and glossary document from the database document from the database as 2 separate downloadable files.

The basic idea behind this database, as pretty much all relational databases is searching. Most relational databases have lots of reports but this database does not. I couldn’t think of any helpful reports to do. When you have all records in the current table showing then you do do a search to find what you want. If to many items are still displayed you do another search and so on. For me I mostly use the live searches because of its instant feedback.

Class items is where nearly all the work goes on in the database. I only made the classes and frameworks visible so the user can see what the classes and frameworks are and get a short description of them as well as any notes that would be helpful about classes or frameworks.

All the windows have some for of search. All but one window have live searches (the list of found items changes as the user types. One window has the old style search where you enter something and then search, or search again.

There are windows about inheritance in the database but that is more useful once you are more familiar with ASObj-C.

The examples come in 3 types: beginning, intermediate and advanced. The buttons in the lower right corner of the class items windows have buttons to choose which examples to display. If a button has gray text then there is no samples for that. If the text is black then there is a sample.

The extra topics popup have a few topics that I included that are not directly about about ASObj-C but are helpful things to know or are useful things but a pain in the butt to figure out. Currently it has a few topics: A brief summary of an application bundle, creating spotlight queries, different types of equality, foundation functions, predicate extra info, and stuff in Xcode.

If you want to display info for a single class then use the “only show items for the class” popup in the bottom right of the window is what you would use. If you check out the stuff in the ASObj-C menu the last 6 items have present searches in them to do specific types of searches.

The ASObj-C menu is where the preferences are accessed. Currently there is only 1 preference for the database and it determines which script editor (Script Debugger or Script Editor) is opened when you type shift-command-s which allows the sample to be sent to to the chosen editor where it is then compiled. This command can also be accessed for the ASObj-C menu.

Well that is a quick run down. The help file explains in more detail. If you still have questions let me know.

Bill

ASObj-C database A16 glossary.rtf.zip (8.7 KB)

ASObj-C database A16 help.rtf.zip (7.6 KB)

Jim,

I forgot that I never answered this question. When I search for things like this there are 2 main things I do. The first is to search the documentation in Xcode help. That I’m pretty sure you knew about. The second is to use a special kind of google search.

I took the top key in your list, NSURLAttributeModificationDateKey, and searched google with
site:apple.com NSURLAttributeModificationDateKey
This tells google to do a regular search but only search on the apple.com website.

The top of the search results was the definition of this key. The second result returned
https://developer.apple.com/reference/foundation/nsurlresourcekey
which is a long list of constants of NSURL constants that include all but 4 of the constants in your list. There are many more on the page.


I searched for NSURLTotalFileSizeKey
site:apple.com NSURLTotalFileSizeKey
On the four search result I found:
https://developer.apple.com/reference/foundation/foundation_constants?language=objc
This is another long list of constants.


Then I searched for NSURLTotalFileAllocatedSizeKey:
The 4th search result was another page with a list of 5 keys:
https://developer.apple.com/reference/foundation/nsurl/file_property_keys?language=objc

NSURLFileSizeKey and NSURLFileAllocatedSizeKey were also on this page


This is the main way I look for lists that a particular key belongs to.

I hope this helps.

Bill