How to structure code for a Cocoa application

I am writing a Cocoa application where I have an automatically generated application delegate: (MyAppDelegate.h / MyAppDelegate.m)

So, I'm not sure of the best way to structure class files for this Cocoa application. I understand MVC (on iPhone) well, but I have a block to try to properly organize the source in a Cocoa application.

I need to create two separate full-screen OpenGL views. The problem is that I can just create classes for "OpenGLView" and then instantiate and call all this code in the application delegate, but it seems messy and essentially not the place for it. What is the best way for me to achieve code structure?

+4
source share
1 answer

Create an instance of your application in the MainMenu.xib file and attach it. When I made Cocoa full-screen stuff, I created instances in the -applicationDidFinishLaunching method of the -applicationDidFinishLaunching delegate. This is * useless, because for full-screen views it really doesn't make sense to use an interface constructor. This is the same as other people making full-screen apps in Cocoa.

+1
source

Source: https://habr.com/ru/post/1303314/


All Articles