有没有“最佳实践”?对于Xcode 4中的组织? [英] Is there a "best practice" for Organization in Xcode 4?

查看:85
本文介绍了有没有“最佳实践”?对于Xcode 4中的组织?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我来自java世界,在我的理解中,文件/类应该在包/文件夹中布置得很好。

I'm coming from the java world, where files/classes should be layed out well structured within packages/folders in my understanding.

Xcode4的最佳做法是什么?我还没有找到Apple的指南。如果有人能把我推到正确的文件,我会很高兴。

What is the best practice in Xcode4? I couldn't find an Apple guideline for this yet. If anyone can push me to the right document, I'd be happy.

如果没有文件:最好的方法是什么?我发现在一个项目文件夹中包含所有Classes有点奇怪 - 在Xcode视图或文件结构内部(奇怪的是文件结构似乎不等于Xcode中的可视化结构)。当然,该项目将在版本控制上(在GitHub上)。

In case there is no document: what is the best to do so? I find it a bit odd to have all of the Classes in one project folder - either inside the Xcode-view or the file structure (strangely filestructure doesn't seem to equal the visual structure in Xcode). Of course the project will be on version-control (on GitHub).

非常感谢提前!

推荐答案

首先,我希望将消防控制器和相关类别的类别分组。但不仅仅是在XCode中创建的组中,也包括在真实文件夹中。因此,当创建一个组而不是在XCode中创建它时,首先在Finder中创建它,然后将该文件夹拖到XCode中并将其组成一个组。现在,当您在该组中添加新文件时,它们也会进入磁盘上的该文件夹。

First of all, I like to have categories of fire controllers and related classes grouped. But not just in groups created in XCode, in real folders too. So, when creating a group instead of creating it in XCode created it in Finder first, then drag that folder into XCode and have it formed into a group. Now when you add new files in that group they will also go into that folder on disk.

其他一些随意的想法:

命名:由于您没有名称空间,因此必须在类前面加上两个或三个字母的前缀(Apple建议使用三个)。即使一开始看起来很奇怪,也要这样做。

Naming: since you don't have namespaces, you must prefix your classes with a two or three-letter prefix (Apple recommends three). Do this even if it seems odd at first.

资源:默认项目喜欢将xib文件与视图控制器分开。在任何大小的应用程序中,我更喜欢将视图控制器和xib文件分组在一个位置。你甚至可以通过这种方式进行图像处理,但通常只有在一个地方将这些图像组合起来更容易。

Resources: The default projects like to separate xib files from view controllers. In an app of any size, I greatly prefer to keep view controllers and xib files grouped in one location. You could even do images this way though generally there are few enough it's easier just to group those in one place.

应用程序内容:我喜欢将所有杂项应用程序分组列表顶部的一个应用程序组中的特定文件(app delegate,info.plist,pch文件,main.m等),使这些位易于查找。

Application stuff: I like to group all of the miscellaneous application specific files (app delegate, info.plist, pch file, main.m, etc) in one Application group at the top of the list to make those bits easy to find.

这篇关于有没有“最佳实践”?对于Xcode 4中的组织?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆