Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

adding .h .m

I'm confused that when a new project is added, the .m file is added with a .h file that contains an initialization. The initialization would be very helpful, except that the titles are the same for both files, so that the intermediate .h (controller) and .m (model) files are missing. Either the user should be able to add .h,.m model and .h,.m control files all at once when a project is opened (which I think is better) or else the project should open with no files, and the user can select an empty .h or .m file to start building the project.

iMac

Posted on Jul 2, 2012 7:10 PM

Reply
25 replies

Jul 2, 2012 8:33 PM in response to mark133

Not quite sure what you are referring to, but .h is a header file and .m is a class implementation file. If you are talking about a Cocoa application, the AppDelegate files are the minimum to get the application started; anything else depends on what is needed for the particular application. You can copy and tweak one of the project templates to add a few more default classes if you are feeling frisky.

Jul 2, 2012 8:53 PM in response to red_menace

I see Cocoa as about half-way completed. Whenever I run into a major stumbling block, I try to document the solution I see as a beginner, in hopes that someone will pick it up and run with it.


As you exemplify, you are proficient at scripting, and almost able to deal with Objective-C. You refer to copying and tweaking files to get what you want. To make Cocoa a more popular platform, the need to do some 'tweaking' to make it work right is a challenge that needs to be addressed and resolved.


You are clearly competent to such a degree that Cocoa should be a joy for you to use, but even you will admit that objective-C is a pain.


I can see where too much Cocoa is a bad thing, but the project is only half baked, and if completed, it would really be a tremendous social asset.

Jul 2, 2012 9:05 PM in response to mark133

Cocoa and Objective-C are going to be running me around for quite a while longer. The included templates are just some plain vanilla projects - to get the cherries and chocolate shavings in there you usually have to add them yourself. I suspect that most of the more serious programmers around here use their own project templates, code snippets, custom build phases, and behaviors to make new projects easier.

Jul 2, 2012 9:18 PM in response to red_menace

I couldn't agree more. Cocoa is not at all what it could be. But it is so promising, I really hope some people at Apple are taking it up.


The Interface Builder is Practically complete. I think it went funny when they started trying to do a 'control builder' and a 'model builder' in the same way as the 'Interface Builder'.


Instead, the model and control should be done as one unit. Maybe where the user 1) enters data types and their variable names to be stored and/or manipulated, 2)enters main functions for the data 3)enters variable names for the available Views actions/outlets 4)enters functions that combine the view variable and the main function and main data variables.


Then the model .h .m and controller .h .m file templates could all be generated at once, with beginning instructions on how they could be manipulated according to the class.

Jul 3, 2012 10:00 AM in response to mark133

I can't quite make out what your class examples are supposed to do, but it looks like classes and the instances of those classes are mixed together (you might still be thinking in procedural terms). If I am understanding correctly, you have an equation class that describes how the equations are built, and a data object class which describes the objects used in the equations.

Jul 3, 2012 11:39 AM in response to red_menace

Doesn't the interface just really only provide the external objects(i.e. classes) and data that are going to be used in the implementation, and gives them names?


Doesn't the implementation really tell what the class is able to do?


Then it takes another, external class, to declare the .h,.m object(the class) in it's interface, and give a name to it as well as whatever other objects and data will be used by itself.


Then the implementation of this second class can create and instance, allocating and initializing the first class.


So it takes four files, Class I .h,.m and Class II .h,.m to understand what classes are and how they are used?

adding .h .m

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.