Xcode 文件和文件夹清理结构和组织
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12087244/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode files and folders clean structure and organization
提问by DigitalVanilla
After four years in development with Xcode I started to ask myself (well, yes, I know, a little too late but when you are deep in coding you don't see other things) what kind of structure and organization of files and folders can be a good one to follow some sort of guidelines.
在使用 Xcode 进行了四年的开发之后,我开始问自己(嗯,是的,我知道,有点晚了,但是当你深入编码时,你看不到其他东西)什么样的文件和文件夹的结构和组织可以是一个遵循某种指导方针的好人。
I saw Google coding guidelinesand I wonder if there's any similar doc around for the subject of this question.
我看到了谷歌编码指南,我想知道这个问题的主题是否有类似的文档。
I can see that if you create a new project in Xcode (I'm using the latest version) you have one folder with the same name of the app, then inside "supporting files", then frameworks and product. The last two are fine, but I just wonder if I add some graphics and other classes and static library and so on, how I could name them and where to put them (ex: some standard graphics like icon and default image will go in a folder named "design" or "standard design" inside "supporting files"). Rules like that.
我可以看到,如果你在 Xcode 中创建一个新项目(我使用的是最新版本),你会有一个与应用程序同名的文件夹,然后是“支持文件”,然后是框架和产品。最后两个很好,但我只是想知道我是否添加了一些图形和其他类以及静态库等等,我如何命名它们以及放置它们的位置(例如:一些标准图形,如图标和默认图像将放在一个“支持文件”中名为“设计”或“标准设计”的文件夹)。那样的规矩。
This is because when you start to handle multiple project (and I mean 3-4 per day) you want to have find the same things in the same folder and even because for future updates and references, you will know where to find the right things in the right place.
这是因为当您开始处理多个项目(我的意思是每天 3-4 个)时,您希望在同一个文件夹中找到相同的内容,甚至因为对于未来的更新和参考,您将知道在哪里可以找到正确的内容在正确的地方。
回答by Analog File
I think the best strategy is to organize them in groups (groups are the "folders"within XCode, which are not real filesystem folders unless you esplicitely make them such) according to what part of the program functionality they are related to. It is somewhat debatable whether also organizing them in actual folders is a good idea or not (sometimes I do sometimes I don't).
我认为最好的策略是根据它们与程序功能的哪个部分相关,将它们组织成组(组是XCode中的“文件夹”,除非您明确地将它们设为这样,否则它们不是真正的文件系统文件夹)。在实际文件夹中组织它们是否是一个好主意,这有点值得商榷(有时我这样做有时我不这样做)。
However much before you start organizing the files in groups you should start organizing the structure of your project. And with that I mean systematically follow best practices related to how to modularize the project, where to put your code (where meaning in which classes) etc.
然而,在开始按组组织文件之前,您应该开始组织项目的结构。我的意思是系统地遵循与如何模块化项目相关的最佳实践,将代码放在哪里(在哪里意味着在哪些类中)等。
A pretty good starting point on how to organize the project is Matt Gallagher's The design of every Mac applicationpost in his renown blog CocoaWithLove. His ontological analysis also makes almost self-evident how to organize the groups (and in fact he admits to having created the ontology by transcribing the group names of a project).
关于如何组织项目的一个很好的起点是 Matt Gallagher在他著名的博客CocoaWithLove 中的每一个 Mac 应用程序的设计帖子。他的本体论分析也使如何组织组几乎不言而喻(事实上,他承认通过转录项目的组名创建了本体)。