你如何构建一个iPhone XCode项目? [英] How do You structure an iPhone XCode project?

查看:165
本文介绍了你如何构建一个iPhone XCode项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

建立群组/文件夹的好方法是什么?

What are good ways of building groups/folders?

我尝试过使用公共群组的功能(功能加模型的UI等)。我也尝试过用户界面,模型等。

I've tried by feature (UI for a feature plus model etc) with a common group. I've also tried by UI, model, etc.

前者保持一致,很适合iPhone范例。后者意味着我会跳得更多。

The former keeps like things together which fits the iPhone paradigm nicely. The latter means I jump around a bit more.

你怎么看?

推荐答案

标准Xcode MVC文件夹结构如下。

The standard Xcode MVC folder structure is as follows.


  1. CoreData :包含DataModel和实体类。

  1. CoreData : Contains DataModel and Entity Classes.

扩展:包含一个类(默认的apple类扩展+项目类扩展。)

Extension : Contain One class(default apple class extensions+project class extensions.)

Helper :包含第三方类/框架(例如SWRevealController)+桥接类(例如基于Swift的项目中的Obj C类)

Helper: Contain Third Party classes/Frameworks (eg. SWRevealController) + Bridging classes (eg. Obj C class in Swift based project)

模型:创建一个单例类(例如.AppModel - NSArray,NSDictionary,String等)来保存数据。解决和存储数据的Web服务响应也在这里完成。

Model : Make a singleton class (eg.AppModel - NSArray,NSDictionary, String etc.) for saving data. The Web Service Response parsing and storing data is also done here.

服务:包含Web服务进程(例如,登录验证, HTTP请求/响应)

Services : Contain Web Service processes (eg. Login Verification, HTTP Request/Response)

查看:包含storyboard,LaunchScreen.XIB和View Classes。创建一个子文件夹单元格 - 包含UITableViewCell,UICollectionViewCell等。

View : Contain storyboard, LaunchScreen.XIB and View Classes. Make a sub folder Cells - contain UITableViewCell, UICollectionViewCell etc.

控制器:包含与UIElements相关的逻辑或代码(例如UIButton的参考+点击动作)

Controller: Contain Logic or Code related to UIElements (eg. UIButton’s reference+ clicked action)

这篇关于你如何构建一个iPhone XCode项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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