简体   繁体   English

如何在新的XCode项目中包含函数和类别?

[英]How to include functions and categories in new XCode projects?

I have created categories of NSBezierPath, functions that deals with geometric objects, and classes that use aforementioned code. 我创建了NSBezierPath类别,处理几何对象的函数以及使用上述代码的类。

What is the most natural way to use include them in new projects? 在新项目中使用它们的最自然方法是什么? I'm using them in almost all of my projects. 我几乎在所有项目中都使用它们。

Make a framework of it and use the framework in your project. 创建一个框架并在您的项目中使用该框架。

This is the most sensible option, IMO, if those classes provide a coherent set of features. 如果这些类提供了一组连贯的功能,则这是最明智的选择,即IMO。 Otherwise, you could create a set of frameworks; 否则,您可以创建一组框架。 in this case, though, beware of dependencies among them, because it would make managing them more complex and maybe the effort of it would not give any advantage. 但是,在这种情况下,请提防它们之间的依赖关系,因为这会使管理它们变得更加复杂,也许付出的努力不会带来任何好处。

If you really want to go 'pro' you might think of creating your own Xcode template to include those frameworks by default in your projects. 如果您真的想成为“专业人士”,您可能会考虑创建自己的Xcode模板,以在项目中默认包含这些框架。 Have a look at this post about making Xcode templates. 看看这个帖子有关使Xcode的模板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM