Objective-C standards document

后端 未结 3 1523
南旧
南旧 2020-12-29 04:56

I\'m a C and C++ programmer trying to get started with Objective-C. I\'m really bewildered, though, by the apparent total absence of a standards document for the language an

相关标签:
3条回答
  • 2020-12-29 05:07

    Found at least some of the language definitions of Objective-C, including syntax etc. (see link)

    I'm just now where you have been 3 years ago (according to the date in your question): I'm starting to get into Objective-C, and I find it as well strange that there seems to be no reference manual, where I could for example look up the exact meaning and definition of syntax, keywords etc.

    I've now discovered, that at least some of it can be found in a document which is related to cocoa (Cocoa Core Competencies). The link for example jumps to the definition of the keyword "@property".

    In my POV this is not only relevant only specifically to Cocoa but is generally defining the Objective-C language extension of C. Thats why I wouldn't have searched for it in documents labled "Cocoa ".

    0 讨论(0)
  • 2020-12-29 05:17

    I think I understand your question correctly, so I will answer accordingly...

    I highly recommend the documents in the Apple Developer Library. Here are a couple basic guides to get you started:

    Concepts in Objective-C Programming

    Programming with Objective-C

    Cocoa Fundamentals Guide

    iOS App Programming

    The documents there are the definitive source for Objective-C and Cocoa best practices and coding standards. There are many more documents on a multitude of topics, so make sure to check that website out.

    You also asked about how to know what methods are available for objects. To know that, you can check out the Class References.

    For example:

    NSObject Class Reference

    The difference between the guides and the class references is that the guides are more about the concepts behind the code whereas the class references are a list of the methods and properties available for a class.

    Hope this helped.

    0 讨论(0)
  • 2020-12-29 05:22

    Unfortunately there is no Standard for ObjC as there is for C++ or C. Apple being the main user and driver behind the language, their compiler implementation (the ObjC bits of Clang) is the de facto Standard. Their old document (broken link) "The Objective-C Programming Language" was about as close as you got to a prose version, and it was nowhere near the precision of either of those other languages' Standards (and it tends to lag behind the compiler).

    It may still be floating around on the web somewhere, but it is no longer up-to-date. "Programming with Objective-C" seems to be their intended replacement (but again, it's nothing like a standard).

    Regarding your comment (10k link only) under Tim's deleted answer, the Cocoa root class is NSObject, and its interface is documented, but its source is not available. Note that the NSObject protocol is also an extremely important part of a Cocoa object's functionality. Apple's runtime is open-source,* and has a root class called Object, I assume for purposes of demonstration. It's not used in Cocoa programming.

    You already know about all of this, of course. The direct answer to your question is, "there isn't one". Most of the syntax is the same as C, though, as bbum points out: Authoritative description of ObjectiveC string literals? (yes, I copy-pasted my comment from there into the beginning of this answer).


    *Note that contrary to what you say in your question, this is the actual, up-to-date, runtime.

    0 讨论(0)
提交回复
热议问题