开发者

Starting a new Xcode project from a template vs. a blank project

I sometimes find it's easier to create a new project from scratch in other IDEs simply because its often more difficult to understand and tweak the generated template code than it is to write the code you need from scratch.

Do seasoned iPhone developers still use templates when creating new projects?

How diff开发者_JS百科icult is it to add functionality to a template project that isn't initially included in the template? For example, if I don't check the "Use Core Data" option when creating a new project, how difficult does that make it to use Core Data later on if I changed my mind?


Templates are just here to simplify the life. If you start with a table view project and then you want add the Core Data, you have to create your model adding a new xcdatamodel file. After you have to define the managedObjectModel, the manageObjectContext and the persistentStoreCoordinator in you application like that:

NSManagedObjectModel *managedObjectModel;
NSManagedObjectContext *managedObjectContext;       
NSPersistentStoreCoordinator *persistentStoreCoordinator;

And to finish you'll have to instantiate those variables and create some methods to do your life easier. So as you can see that's a bit stronger than create a new project with this template. Templates are just here to gain time. =)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜